我在向Qt Creator中添加OpenCV库时遇到问题。
这是我的代码:
INCLUDEPATH += "C:/OpenCV/opencv/build/include" \
CONFIG(debug,debug|release) {
LIBS += -L"C:/OpenCV/opencv/build/x86/vc12/lib" \
-lopencv_core2413d \
-lopencv_calib3d2413d \
-lopencv_contrib2413d \
-lopencv_features2d2413d \
-lopencv_flann2413d \
-lopencv_gpu2413d \
-lopencv_highgui2413d \
-lopencv_imgproc2413d \
-lopencv_videostab2413d
}
CONFIG(debug,debug|release) {
DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
LIBS += -L"C:/OptiNavCV/opencv/build/x86/vc12/lib" \
-lopencv_core2413 \
-lopencv_calib3d2413 \
-lopencv_contrib2413 \
-lopencv_features2d2413 \
-lopencv_flann2413 \
-lopencv_gpu2413 \
-lopencv_highgui2413 \
-lopencv_imgproc2413 \
-lopencv_videostab2413
}
}
错误: C:\ Qt \ Qt5.5.1 \ Tools \ QtCreator \ bin \ jom.exe -f Makefile.Release cl -c -nologo -Zc:wchar_t -FS -O2 -MD -Zc:strictStrings -GR -W3 -w34100 -w34189 -w44996 -EHsc -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I。 。\ TestAppQt -I。 -I ........ \ OptiNavCV \ opencv \ build \ include -I ........ \ Qt \ Qt5.5.1 \ 5.5 \ msvc2013_64 \ include -I ........ \ Qt \ Qt5.5.1 \ 5.5 \ msvc2013_64 \ include \ QtWidgets -I ........ \ Qt \ Qt5.5.1 \ 5.5 \ msvc2013_64 \ include \ QtGui -I ........ \ Qt \ Qt5.5.1 \ 5.5 \ msvc2013_64 \ include \ QtANGLE -I ........ \ Qt \ Qt5.5.1 \ 5.5 \ msvc2013_64 \ include \ QtCore -Irelease -I。 -I ........ \ Qt \ Qt5.5.1 \ 5.5 \ msvc2013_64 \ mkspecs \ win32-msvc2013 -Forelease \ @C:\ Users \ szymo \ AppData \ Local \ Temp \ mainwindow.obj.11752.15.jom mainwindow.cpp link / NOLOGO / DYNAMICBASE / NXCOMPAT / INCREMENTAL:NO / SUBSYSTEM:WINDOWS" / MANIFESTDEPENDENCY:type =' win32'命名=' Microsoft.Windows.Common - 控制'版本=' 6.0.0.0'公钥=' 6595b64144ccf1df'语言=' ' ProcessorArchitecture用于=' '" / MANIFEST:embed /OUT:release\TestAppQt.exe @C:\ Users \ szymo \ AppData \ Local \ Temp \ TestAppQt.exe.11752.1422.jom mainwindow.obj:错误LNK2019:未解析的外部符号" void __cdecl cv :: fastFree(void *)" (?fastFree @ cv @@ YAXPEAX @ Z)在函数" public中引用:__ cdecl MainWindow :: MainWindow(类QWidget *)" (?? 0MainWindow @@ @ QEAA @@@ PEAVQWidget Z) mainwindow.obj:错误LNK2019:未解析的外部符号" public:__ cdecl cv :: _ InputArray :: _ InputArray(class cv :: Mat const&)"函数" public:__ cdecl MainWindow :: MainWindow(class QWidget *)" (?? 0MainWindow @@ @ QEAA @@@ PEAVQWidget Z) mainwindow.obj:错误LNK2019:未解析的外部符号" public:void __cdecl cv :: Mat :: deallocate(void)" (?deallocate @ Mat @ cv @@ QEAAXXZ)在函数" public中引用:__ cdecl MainWindow :: MainWindow(类QWidget *)" (?? 0MainWindow @@ @ QEAA @@@ PEAVQWidget Z) mainwindow.obj:错误LNK2019:未解析的外部符号" int __cdecl cv :: _ interlockedExchangeAdd(int *,int)"函数" public:__ cdecl MainWindow :: MainWindow(class QWidget *)" (?? 0MainWindow @@ @ QEAA @@@ PEAVQWidget Z) mainwindow.obj:错误LNK2019:未解析的外部符号" void __cdecl cv :: imshow(class std :: basic_string,class std :: allocator> const&,class cv :: _ InputArray const&)&#34 ; (?imshow @ cv @@ YAXAEBV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ AEBV_InputArray @ 1 @@ Z)在函数" public中引用:__ cdecl MainWindow :: MainWindow(类QWidget *)" (?? 0MainWindow @@ @ QEAA @@@ PEAVQWidget Z) mainwindow.obj:错误LNK2019:未解析的外部符号" class cv :: Mat __cdecl cv :: imread(class std :: basic_string,class std :: allocator> const&,int)" (?imread @ cv @@ YA?AVMat @ 1 @ AEBV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ H @ Z)在函数&#中引用34; public:__ cdecl MainWindow :: MainWindow(class QWidget *)" (?? 0MainWindow @@ @ QEAA @@@ PEAVQWidget Z) release \ TestAppQt.exe:致命错误LNK1120:6个未解析的外部 jom:C:\ Users \ szymo \ Documents \ build-TestAppQt-Desktop_Qt_5_5_1_MSVC2013_64bit-Release \ Makefile.Release [release \ TestAppQt.exe]错误1120 jom:C:\ Users \ szymo \ Documents \ build-TestAppQt-Desktop_Qt_5_5_1_MSVC2013_64bit-Release \ Makefile [release]错误2 09:52:59:进程" C:\ Qt \ Qt5.5.1 \ Tools \ QtCreator \ bin \ jom.exe"退出代码2。 构建/部署项目TestAppQt时出错(工具包:Desktop Qt 5.5.1 MSVC2013 64bit) 执行步骤"制作"
答案 0 :(得分:1)
您正在尝试链接32位库(opencv_core)
-L"C:/OptiNavCV/opencv/build/x86/vc12/lib" \
...
LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)"
到x64项目
TestAppQt (kit: Desktop Qt 5.5.1 MSVC2013 64bit)