我无法使用VS2010运行openCV。我下载了OpenCV-2.3.1-win-superpack并在C:\ opencv中解压缩openCV2.3.1并将CMake buide项目用于C:\ opencv \ vs2010。接下来,我将所有模块和lib设置为 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_Helloworld.exe中0x0f6d49a6处的未处理异常:0xC0000005:访问冲突读取位置0x00000018。
当我点击它时显示
没有可用的来源 没有为任何调用堆栈帧加载符号。源代码无法显示。 调用堆栈位置: KernelBase.dll!75289617()
在openCV教程中使用旧版本进行openCV安装。所以我发现谷歌和安装遵循这一点。我不确定我会错过这个代码或安装。
我创建了新的Project并像这样Setup OpenCV-2.3 for Visual Studio 2010进行配置,并将所有dll复制到我的Project中的Debug文件夹中。我没有构建错误,但是当我运行它时显示此错误。
'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).
答案 0 :(得分:1)
你检查过imread是否有效吗?
if ( image.data == NULL ) {
// failed
}
答案 1 :(得分:1)
转到选项>调试>符号并将'Microsoft符号服务器'检查为符号文件(.pdb)位置'。这有助于我摆脱'无法找到或打开PDB文件'的错误。
答案 2 :(得分:0)
您是否也将opencv_highgui231d.dll
复制到了构建输出目录中?我可以看到它加载opencv_core
dll但不加载highgui
。