OpenCV、eclipse编译问题
我有一个编译问题,无法解决 c++ 中的 OpenCV2.1 问题。
这是我试图编译的一个简单的测试代码:
#include <iostream>
#include "cv.h"
using namespace std;
int main() {
cout << "Hello World" << endl; // prints !!!Hello World!!!
cv::Mat mtx;
return 0;
}
我出现一个带有未定义引用的编译错误,如下
**** Build of configuration Debug for project CJMVideo ****
**** Internal Builder is used for build ****
g++ -IC:\OpenCV2.1\include\opencv -IC:\Program Files\Point Grey Research\FlyCapture2\include -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CJMVideo.o ..\src\CJMVideo.cpp
g++ -LC:\OpenCV2.1\lib -LC:\Program Files\Point Grey Research\FlyCapture2\lib64 -Xlinker --enable-auto-import -oCJMVideo.exe src\CJMVideo.o -lcxcore210 -lcv210 -lhighgui210 -lml210 -lFlyCapture2
src\CJMVideo.o:C:/OpenCV2.1/include/opencv/cxmat.hpp:378: undefined reference to `cv::fastFree(void*)'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1438 ms.
错误是C:/OpenCV2.1/include/opencv/cxmat.hpp:378: undefined reference to `cv ::fastFree(void*)'
我相信我已经从上面的命令正确编译了所有库...问题是什么?
谢谢
I have a compile problem I can't figure out for OpenCV2.1 in c++.
Here is a simple test code I am trying to compile:
#include <iostream>
#include "cv.h"
using namespace std;
int main() {
cout << "Hello World" << endl; // prints !!!Hello World!!!
cv::Mat mtx;
return 0;
}
I a compile error with an undefined reference as follows
**** Build of configuration Debug for project CJMVideo ****
**** Internal Builder is used for build ****
g++ -IC:\OpenCV2.1\include\opencv -IC:\Program Files\Point Grey Research\FlyCapture2\include -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CJMVideo.o ..\src\CJMVideo.cpp
g++ -LC:\OpenCV2.1\lib -LC:\Program Files\Point Grey Research\FlyCapture2\lib64 -Xlinker --enable-auto-import -oCJMVideo.exe src\CJMVideo.o -lcxcore210 -lcv210 -lhighgui210 -lml210 -lFlyCapture2
src\CJMVideo.o:C:/OpenCV2.1/include/opencv/cxmat.hpp:378: undefined reference to `cv::fastFree(void*)'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1438 ms.
The error is C:/OpenCV2.1/include/opencv/cxmat.hpp:378: undefined reference to `cv::fastFree(void*)'
I believe I have compiled all the libraries correctly from the above command...What is the problem?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尽管该消息表明它尚未在 OpenCV 库上找到该符号,但我必须指出,从上面粘贴的命令行来看,您似乎正在尝试将您的应用程序链接到 64 位编译库,如
所示-LC:\Program Files\Point Grey Research\FlyCapture2\lib64
。这意味着您也必须将 OpenCV 编译为 64 位,或者将两者都编译为 32 位。您可能缺少一个图书馆。在 Windows 上,我的 OpenCV 项目通常添加
cv210.lib cvaux210.lib cxcore210.lib cxts210.lib highgui210.lib
,但我大多数时候使用 Visual Studio 2005。Even though the message suggests it has not found that symbol on the OpenCV libraries, I must point out that from the command line pasted above, it seems you are trying to link your application against 64-bit compiled libraries, as indicated by
-LC:\Program Files\Point Grey Research\FlyCapture2\lib64
. That means you must compile OpenCV to be 64-bit too, or compile both to be 32 bits.You are probably missing one library. On Windows, my OpenCV projects usually adds
cv210.lib cvaux210.lib cxcore210.lib cxts210.lib highgui210.lib
, but I use Visual Studio 2005 most of the times.当使用 intel TBB 并行库构建 OpenCV 库时,我在链接 cv::fastfree 时遇到问题,无需 TBB 即可构建
I have had problems linking cv::fastfree when the OpenCV lib was built with the intel TBB parallel library, building without TBB worked