我正在尝试编译一个OpenCV示例(Setup OpenCV-2.3 for Visual Studio 2010),但我似乎无法让它工作。我按照教程,运行的所有内容似乎工作正常,但是一旦我尝试运行该示例,链接器就会抛出错误。奇怪的是,当我-verbose
时,我得到以下信息:
1> Unused libraries:
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_calib3d2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_contrib2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_core2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_features2d2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_flann2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_gpu2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_highgui2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_imgproc2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_legacy2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_ml2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_nonfree2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_objdetect2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_ocl2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_photo2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_stitching2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_superres2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_ts2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_video2411d.lib
1> D:\OpenCV\opencv\build\x64\vc12\lib\opencv_videostab2411d.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\winspool.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\oleaut32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbc32.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbccp32.lib
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\OLDNAMES.lib
1>
1>main.obj : error LNK2019: unresolved external symbol _cvNamedWindow referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _cvShowImage referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _cvLoadImage referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _cvWaitKey referenced in function _main
1>d:\documents\visual studio 2013\Projects\testOpenCV\Debug\testOpenCV.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
未使用的库'给了我包含的所有OpenCV库,但不知何故链接器没有使用这些库,而它们是运行程序所必需的。我该怎么做才能解决这个问题?