我无法使用 VS2010 运行 openCV。我下载了 OpenCV-2.3.1-win-superpack 并在 C:\opencv 中提取 openCV2.3.1 并将 CMake buide 项目用于 C:\opencv\vs2010。接下来,我设置包含所有模块和库到 C:\opencv\build\x86\vc10\lib 并将附加依赖项设置为
opencv_core231d.lib opencv_highgui231d.lib opencv_imgproc231d.lib opencv_features2d231d.lib opencv_calib3d231d.lib
之后,我从 C:\opencv\build\x86\vc10\bin 复制到项目中的 Debug 文件夹。
我构建此代码没有任何错误。
include "stdafx.h"
include "opencv2/core/core.hpp"
include "opencv2/highgui/highgui.hpp"
int main(){
cv::Mat image = cv::imread("Desert.jpg");
cv::namedWindow("My Image");
cv::imshow("My Image", image);
cv::waitKey(5000);
return 1;
}
'opencv_hello.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Users\PKRU\Documents\Visual Studio 2010\Projects\opencv_hello\Debug\opencv_core231d.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'opencv_hello.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'opencv_hello.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\avifil32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\winmm.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\msacm32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\msvfw32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\avicap32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\version.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'opencv_hello.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
The program '[5308] opencv_hello.exe: Native' has exited with code -1 (0xffffffff).
最佳答案
你检查过imread是否有效吗?
if ( image.data == NULL ) {
// failed
}
https://stackoverflow.com/questions/7345481/