【问题标题】:How & where to add debugging symbols for Visual C++ OpenCV project如何以及在何处为 Visual C++ OpenCV 项目添加调试符号
【发布时间】:2013-10-17 20:34:29
【问题描述】:

我在 Visual Studio 2012 中建立了一个 OpenCV C++ 项目。为了让它工作,我使用了各种项目属性页来

  1. 其他包含目录:$(SolutionDir)..\Libs\OpenCV\2.4.6\include
  2. 其他库目录:$(SolutionDir)..\Libs\OpenCV\2.4.6\$(Platform)\$(Configuration)
  3. 其他依赖项:各种文件,包括opencv_highgui246d.dll
  4. 构建后事件,命令行:复制 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


【解决方案1】:
  • 问题:您正在使用 2.4.6 附带的 prebuild 库,您将能够调试您自己的代码,但您可以' t 深入研究 opencv 库(如 highgui246d.dll)。

  • 原因:没有提供所需的 pdb 文件(想想看,这会将下载量扩大到千兆字节范围)

  • 补救措施:如果您确实需要在调试时深入挖掘 opencv 库,则必须重新编译它们(cmake 和所有那些 jive),因为这实际上会生成所需的 pdb 文件

    李>

【讨论】:

  • 谢谢@berak;不用说我无法说服 OpenCV 构建,但那是 another story
  • 是的,只是看着它;)
  • 我想我知道我做错了什么 - 只是尝试看看修复是否有效,但会议一直在阻碍!
  • @berak 你好!实际上我也有同样的问题opencv_world300d.dll'. Cannot find or open the PDB file我是否需要从源代码构建 OpenCV
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多