with Dev-C++, but got undefined reference

asked 2017-11-26 03:49:53 -0600

Please help me out. Thanks in advance.

I think I already include the header and library folder, as well as the opencv_world library, but still go the following errors. (I also set the env path variable). Please kindly help to check the following log for me and share some comments of yours, thanks. ps. I already comment out other function calls, except VideoCapture cap(0); and got undefined reference to VideoCapture.

gcc.exe -D__DEBUG__ -c main.cpp -o main.o -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/opencv/build/include" -I"C:/opencv/build/include" -g3

g++.exe -D__DEBUG__ main.o -o webcam_opencv.exe -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -L"C:/opencv/build/x64/vc14/lib" -L"C:/opencv/build/x64/vc14/lib" ../../../../../opencv/build/x64/vc14/lib/opencv_world331d.lib -g3

main.o: In function main': C:\Users\Tsai\Documents\Webcam\opencv/main.cpp:9: undefined reference tocv::VideoCapture::VideoCapture(int)' C:\Users\Tsai\Documents\Webcam\opencv/main.cpp:9: undefined reference to `cv::VideoCapture::~VideoCapture()' collect2.exe: error: ld returned 1 exit status

Best Wishes Simon

edit retag flag offensive close merge delete

Comments

"/build/x64/vc14/lib/opencv_world331d.lib" -- NO. you cannot use the prebuild opencv libs, they are for VS2015 only.

if you want to use mingw, step1 is: get cmake, and build opencv libs from src.

berak gravatar imageberak ( 2017-11-26 04:21:06 -0600 )edit

Thank you, Berak.

I just tried to compile the opencv based on the following link. https://zahidhasan.github.io/2017-03-... After the steps described within the link, when I tried to compile the sample code, I got the following error....

../../../../../opencv/build/install/x64/mingw/lib/OpenCVConfig.cmake: file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status

Please kindly help. Thanks in advance.

Outerlimits gravatar imageOuterlimits ( 2017-11-28 09:22:18 -0600 )edit

showing links to tutorials is useless, we need to see, what you did

were you able to build the opencv libs ? (in that case it's only a problem of "how to use them" now.

(and probably noone else is using dev-cpp here, so don't expect much, if it is related to that)

berak gravatar imageberak ( 2017-11-28 09:39:24 -0600 )edit

Berak, you are quite right, what I did was wrong...didn't check in detail... When I tried to link the libraries, I selected (all) the cmake files by mistake.

Everything is working now! ^^ Thanks for your help~

Outerlimits gravatar imageOuterlimits ( 2017-11-29 08:53:43 -0600 )edit