Linking ThinPlateSplineShapeTransformer failed (undefined reference)
Hi all,
I built OpenCV 3.1.0-dev (latest by today) and installed it to a subdir of my home dir. Now, I want to compile a simple example cpp-file, using my freshly installed OpenCV
#include <iostream>
#include <opencv2/shape/shape_transformer.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <vector>
int main()
{
auto tps = cv::createThinPlateSplineShapeTransformer();
std::vector<cv::Point2f> sourceP, targetP;
sourceP.push_back(cv::Point2f(0, 0));
targetP.push_back(cv::Point2f(100, 0));
sourceP.push_back(cv::Point2f(799, 0));
targetP.push_back(cv::Point2f(799, 0));
sourceP.push_back(cv::Point2f(0, 599));
targetP.push_back(cv::Point2f(0, 599));
sourceP.push_back(cv::Point2f(799, 599));
targetP.push_back(cv::Point2f(799, 599));
std::vector<cv::DMatch> matches;
for (int i = 0; i < sourceP.size(); ++i)
matches.push_back(cv::DMatch(i, i, 0));
return 0;
}
with the following Makefile
try: try.cpp
g++ -ggdb -std=c++11 `pkg-config --cflags --libs ../install/lib/pkgconfig/opencv.pc` try.cpp -o try
install
is the directory, where I installed the opencv, it contains include
, lib
, share
and others
try.cpp
is the code snippet
The error I'm getting is as follows: asalle@azazaz:~/opencv/try$ make
g++ -ggdb -std=c++11 `pkg-config --cflags --libs ../install/lib/pkgconfig/opencv.pc` try.cpp -o try
/tmp/ccncYN0U.o: In function `main':
/home/asalle/opencv/try/try.cpp:10: undefined reference to `cv::createThinPlateSplineShapeTransformer(double)'
collect2: error: ld returned 1 exit status
make: *** [try] Error 1
I already tried
g++ -std=c++11 -I../install/include -L../install/lib/ -lopencv_shape try.cpp -o try
but with no success.
Any help will be appreciated, Asalle
what does
resolve to ?
(also, g++ will never complain about libs that just don't exist)
I am sorry, I have not quite understood what do you mean by 'what does X resolve to?'. If you're asking about its meaning then is equivalent to the following
Fortunately, I figured it out and already answered my own question, but it has not shown yet. Is there some kind of answers moderation here?
Thanks anyway!
sorry for being unclear, but that's exactly, what was meant ! ;)