0

我在 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;
}

出了点问题,所以我想cap通过在 line 上设置断点来检查属性是什么if(!cap.isOpened())。但是,如果我尝试cap在 Visual Studio 2012 的本地窗口中进行检查,则会收到错误消息:

“信息不可用,没有为 opencv_highgui246d.dll 加载符号”

我不熟悉在 Visual Studio 中设置 C++ 项目(多年来我一直主要使用 C#);我需要做什么才能启用此调试?我是否必须自己构建 OpenCV(如果需要,我应该在哪里使用什么输出)还是有更多文件可以复制并包含在我的构建中?

4

1 回答 1

5
  • 问题:您使用的是 2.4.6 附带的预构建库,您将能够调试自己的代码,但不能深入到 opencv 库(如 highgui246d.dll )。

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

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

于 2013-10-17T20:42:23.970 回答