Compile OpenCV 2.0 in MinGW and Codeblocks (win)
it's a long time since I try to compile OpenCV2.0 in Windows successfully but this has never happened.. (I can compile successfully in Linux)
First I installed MinGW with g++, GDB and Code::Blocks.. than I installed CMake and OpenCV2.0 (editing a "cxoperations.hpp" line to #if GNUC >= 4 || MINGW32)
I make OpenCV from source "OpenCV2.0" folder trough CMake-GUI to a new folder "Compile" selecting Code::blocks MinGW makefiles and selecting the Code::blocks executable file. Now I have three folders in C: OpenCV2.0, MinGW, Compi开发者_C百科led
I opened the "OpenCV.cbp" generated file in Code::Blocks but when I try to compile or debug a file, I get the error: "c_samples - all" uses an invalid compiler. Skipping... Nothing to be done."
Also trough console I can't compile files that uses OpenCV library..
>g++ contours.c -I"C:\OpenCV2.0\include\opencv" -L"C:\OpenCV2.0\lib" -lcxcore -lcv -lhighgui -lcvaux -lml
>C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lcxcore
collect2: ld returned 1 exit status
I hope for your help, thanks!
You just need to use the following command:
g++ contours.c -I"C:\OpenCV2.0\include\opencv" -L"C:\OpenCV2.0\bin" -lcxcore200 -lcv200 -lhighgui200 -lcvaux200 -lml200
精彩评论