【发布时间】:2013-10-17 20:34:29
【问题描述】:
我在 Visual Studio 2012 中建立了一个 OpenCV C++ 项目。为了让它工作,我使用了各种项目属性页来
- 其他包含目录:$(SolutionDir)..\Libs\OpenCV\2.4.6\include
- 其他库目录:$(SolutionDir)..\Libs\OpenCV\2.4.6\$(Platform)\$(Configuration)
- 其他依赖项:各种文件,包括
opencv_highgui246d.dll -
构建后事件,命令行:复制 DLL 和 lib 文件以及一些示例内容:
xcopy /y $(SolutionDir)..\Libs\OpenCV\2.4.6\$(Platform)\$(Configuration)*.dll $(ProjectDir)$(Platform)\$(Configuration)\ xcopy /y $(SolutionDir)..\Libs\OpenCV\2.4.6\$(Platform)\$(Configuration)*.lib $(ProjectDir)$(Platform)\$(Configuration)\ xcopy /y $(ProjectDir)opencv-logo.jpg $(ProjectDir)$(Platform)\$(Configuration)\ xcopy /y $(ProjectDir)sample.wmv $(ProjectDir)$(Platform)\$(Configuration)\
我尝试调试的代码行与此处为VideoCapture OpenCV 类给出的示例代码中的代码行大致相同:http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
但我正在打开一个文件
VideoCapture cap ("sample.wmv");
if (FileExists("sample.wmv"))
{
OutputDebugString("File exists\n");
}
else
{
OutputDebugString("File does not exist\n");
}
if(!cap.isOpened())
{
cout <<"Failed to open camera" << endl;
OutputDebugString("Failed to open camera\n");
return -1;
}
出了点问题,所以我想通过在if(!cap.isOpened()) 行上设置断点来检查cap 上的属性。但是,如果我尝试在 Visual Studio 2012 的本地窗口中检查 cap,则会收到错误消息:
“信息不可用,没有为 opencv_highgui246d.dll 加载符号”
我不熟悉在 Visual Studio 中设置 C++ 项目(多年来我一直主要使用 C#);我需要做什么才能启用此调试?我是否必须自己构建 OpenCV(如果需要,我应该在哪里使用什么输出)还是有更多文件可以复制并包含在我的构建中?
【问题讨论】:
-
调试符号位于 .pdb 文件中。如果您有 opencv_highgui246d.pdb,则将其复制到与 DLL 相同的文件夹中。如果没有,则需要构建 DLL 以获取符号文件。
标签: c++ visual-studio debugging visual-c++ opencv