我想将opencv249与Qt 5.5集成。我的.pro文件是这样的:
INCLUDEPATH += C:/OpenCV249/opencv/build/include
INCLUDEPATH += C:/OpenCV249/opencv/build/include/opencv
INCLUDEPATH += C:/OpenCV249/opencv/build/include/opencv2
LIBS += -LC:/OpenCV249/opencv/build/x86/vc12/lib
LIBS += -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 -lopencv_features2d249 -lopencv_calib3d249
我的代码是这样的:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Mat im=imread("1.jpg");
imshow("kubi",im);
return a.exec();
}
它给出了这些错误:
main.obj:-1: error: LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z) referenced in function "public: __cdecl cv::Mat::~Mat(void)" (??1Mat@cv@@QEAA@XZ)
main.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray@cv@@QEAA@AEBVMat@1@@Z) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ)
main.obj:-1: error: LNK2019: unresolved external symbol "int __cdecl cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd@cv@@YAHPEAHH@Z) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ)
main.obj:-1: error: LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@1@@Z) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?imread@cv@@YA?AVMat@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function main
debug\Sercan.exe:-1: error: LNK1120: 6 unresolved externals
我不知道如何修复它。
答案 0 :(得分:1)
你的lib路径是否正确?
你应该改变吗?
LIBS += -LC:/opencv/build/x86/vc12/lib
与
LIBS += -LC:/OpenCV249/opencv/build/x86/vc12/lib
这只是一个疯狂的猜测,其他一切看起来都不错......