如何&在Visual C ++ OpenCV项目中添加调试符号 [英] How & where to add debugging symbols for Visual C++ OpenCV project

查看:168
本文介绍了如何&在Visual C ++ OpenCV项目中添加调试符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2012中设置了一个OpenCV C ++项目。为了使其工作,我使用各种项目属性页面来

I've set up an OpenCV C++ project in Visual Studio 2012. To get it working I have use various project property pages to


  1. 其他包含目录:$(SolutionDir).. \Libs\OpenCV\2.4.6\include

  2. 附加库目录:$(SolutionDir).. \Libs\\ \\OpenCV\2.4.6\ $(Platform)\ $(配置)

  3. 其他依赖关系:包括 opencv_highgui246d.dll

  4. 生成后事件,命令行:通过DLL和lib文件复制,并提供一些示例内容:

  1. Additional Include Directories: $(SolutionDir)..\Libs\OpenCV\2.4.6\include
  2. Additional Library Directories: $(SolutionDir)..\Libs\OpenCV\2.4.6\$(Platform)\$(Configuration)
  3. Additional Dependencies: various files including opencv_highgui246d.dll
  4. Post-Build Event, Command Line: copies over the DLLs and lib files and some sample content thus:

xcopy / y $(SolutionDir).. \Libs\OpenCV\2.4.6\ $(Platform)\ $(Configuration)*。dll $(ProjectDir)$(Platform)\ $ )\
xcopy / y $(SolutionDir).. \Libs\OpenCV\2.4.6\ $(Platform)\ $(Configuration)*。lib $(ProjectDir)$(Platform) \ $(配置)\
xcopy / y $(ProjectDir)opencv-logo.jpg $(ProjectDir)$(Platform) \\ $(配置)\
xcopy / y $(ProjectDir)sample.wmv $(ProjectDir)$(Platform)\ $(配置)\

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

The lines of code I'm trying to debug are more-or-less the same as those in the sample code given for the VideoCapture OpenCV class here: 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 通过在 if(!cap.isOpened())行上设置一个断点。但是如果我尝试在Visual Studio 2012的本地窗口中检查 cap ,我得到错误:

Something's going wrong so I want to check what the properties are on cap by setting a breakpoint on the line if(!cap.isOpened()). But if I try to examine cap in the locals window in Visual Studio 2012 I get the error:

信息不可用,没有加载opencv_highgui246d.dll的符号

"Information not available, no symbols loaded for opencv_highgui246d.dll"

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

I'm unfamiliar with setting up C++ projects in Visual Studio (I've been using mostly C# for years now); what do I need to do to enable this debugging? Do I have to build OpenCV myself (and if so what output should I use where) or are there more files I can copy over and include in my build?

推荐答案


  • 问题:您正在使用2.4.6附带的 prebuild libs,您将能够调试>你自己的代码,但是你不能潜入opencv库(如highgui246d.dll)。

    • problem: you're using the prebuild libs that come with 2.4.6, you'll be able to debug your own code but you can't dive into the opencv libs ( like highgui246d.dll ).

      原因:需要pdb文件没有提供(想想,这将炸毁下载到千兆字节范围)

      reason: the pdb files needed for that are not supplied ( think of it , that would blow up the download to the gigabyte range )

      补救:如果你真的需要挖掘opencv库在调试时,您必须重新编译(cmake和所有jive),因为这将实际生成所需的pdb文件

      remedy: if you really need to dig into the opencv libs while debugging, you'll have to recompile them ( cmake and all that jive) as this will actually generate the needed pdb files

      这篇关于如何&amp;在Visual C ++ OpenCV项目中添加调试符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆