Ask Your Question

Florian's profile - activity

2016-11-29 06:30:41 -0600 asked a question Linking error on compile

I installed opencv on fedora 24 with g++ 6.2.1 and cmake 3.6.2. I launched cmake CMakeList.txt in 'samples/cpp/example_cmake/', it work, but when I use 'make' I obtain:

[ 50%] Linking CXX executable opencv_example
CMakeFiles/opencv_example.dir/example.cpp.o: In function `main':
example.cpp:(.text+0x11d): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
example.cpp:(.text+0x202): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
CMakeFiles/opencv_example.dir/example.cpp.o: In function `drawText(cv::Mat&)':
example.cpp:(.text+0x39e): undefined reference to `cv::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
CMakeFiles/opencv_example.dir/example.cpp.o: In function `cv::String::String(char const*)':
example.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4d): undefined reference to `cv::String::allocate(unsigned long)'
CMakeFiles/opencv_example.dir/example.cpp.o: In function `cv::String::~String()':
example.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
collect2: error: ld returned 1 exit status
CMakeFiles/opencv_example.dir/build.make:112: recipe for target 'opencv_example' failed
make[2]: *** [opencv_example] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/opencv_example.dir/all' failed
make[1]: *** [CMakeFiles/opencv_example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I can't compile any opencv example. Does someone can help me ?