Ask Your Question
0

Windows - cmake succeed but make failed [closed] [closed]

asked 2016-07-19 04:01:18 -0600

mnems gravatar image

updated 2018-01-08 11:52:17 -0600

Hi everyone,

I know there are a lot of topic about openCV compilation but I cannot find a solution to my issue. Under windows 7 I have successfully download and compiled openCV source using cmake. To be sure of it I have executed opencv_test_core which seems to work. Now that I want to make my own project, I followed this tuto http://docs.opencv.org/3.1.0/db/df5/t... I am using cmake GUI and configuration and generation seem to work, I have this result without warnings : Configuring done Generating done. When I try to lauch the make command I have this return :

$ make

Scanning dependencies of target DisplayImage [ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.obj make[2]: * [CMakeFiles/DisplayImage.dir/build.make:64: CMakeFiles/DisplayImage.dir/DisplayImage.cpp.obj] Error 1 make[1]: [CMakeFiles/Makefile2:68: CMakeFiles/DisplayImage.dir/all] Error 2 make: ** [Makefile:84: all] Error 2

I don't know where to find more log about this error and I have no idea where the problem is... Does someone have an idea about it ?

EDIT: I compiled in debug mode for more output

CMakeFiles/DisplayImage.dir/objects.a(DisplayImage.cpp.obj): in « cv::String::String(char const) »: C:/dev/sdk/OpenCV/opencv/build/x64/cmake/install/include/opencv2/core/cvstd.hpp:625: undefined reference to « cv::String::allocate(unsigned long) » C:/dev/sdk/OpenCV/opencv/build/x64/cmake/install/include/opencv2/core/cvstd.hpp:625:(.text$_ZN2cv6StringC1EPKc[_ZN2cv6StringC1EPKc]+0x4a): relocation truncated to fit : R_X86_64_PC32 to the undefined symbol cv::String::allocate(unsigned long) collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/DisplayImage.dir/build.make:115: DisplayImage.exe] Error 1 make[1]: [CMakeFiles/Makefile2:68: CMakeFiles/DisplayImage.dir/all] Error 2 make: ** [Makefile:84: all] Error 2

According to what I read it seems to be a library link order issue.

EDIT 2: Well, I tried to answer my own question but since I am new my answer just get erased... :( I solved the issue by using the same compiler version when compiling opencv from sources and my project. Plus I had to use mingw64 terminal instead of msys terminal. Don't know why since they have the same PATH var and use the same 'make'... Anyway lena is now showing on the screen which is quit a relief for me!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2018-01-08 11:52:31.285327

1 answer

Sort by » oldest newest most voted
0

answered 2016-07-19 09:09:51 -0600

mnems gravatar image

updated 2016-07-19 09:10:39 -0600

I manage to partially-succeed the build by switching the compiler from mingw64\bin\g++ to usr\bin\g++ However I still have an issue, although I can declare variable such as Mat Image (see the tuto), I cannot call 'imread' without receiving this compilation error : undefined reference to « cv::String::allocate(unsigned long) »

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-07-19 04:01:18 -0600

Seen: 454 times

Last updated: Jul 20 '16