1

自从我尝试在 Windows 中成功编译 OpenCV2.0 以来已经很长时间了,但这从未发生过..(我可以在 Linux 中成功编译)

首先,我使用 g++、GDB 和 Code::Blocks 安装了 MinGW。然后我安装了 CMake 和 OpenCV2.0(将“cxoperations.hpp”行编辑为 #if GNUC >= 4 || MINGW32

我通过 CMake-GUI 从源“OpenCV2.0”文件夹制作 OpenCV 到一个新文件夹“编译”,选择 Code::blocks MinGW makefiles 并选择 Code::blocks 可执行文件。现在我在 C 中有三个文件夹:OpenCV2.0、MinGW、Compiled

我在 Code::Blocks 中打开了“OpenCV.cbp”生成的文件,但是当我尝试编译或调试文件时,出现错误:“c_samples - all”使用了无效的编译器。跳过……无事可做。”

同样通过控制台我无法编译使用 OpenCV 库的文件..

>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

希望对您有所帮助,谢谢!

4

1 回答 1

0

您只需要使用以下命令:

g++ contours.c -I"C:\OpenCV2.0\include\opencv" -L"C:\OpenCV2.0\bin" -lcxcore200 -lcv200 -lhighgui200 -lcvaux200 -lml200
于 2010-07-01T01:25:55.347 回答