2013-10-17 22 views
0

我已经建立了在Visual Studio 2012的OpenCV的C++项目得到它的工作我必须使用不同的项目属性页如何及在哪里添加调试符号为Visual C++ OpenCV的项目

  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)* .ib $(ProjectDir) $(ProjectDir)$(ProjectDir)$(Platform)$(Configuration)\ xcopy/y $(ProjectDir)sample.wmv $( ProjectDir)$(Platform)\ $(Configuration)\

我试图调试的代码行与示例代码giv中的代码行或多或少相同恩为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什么就行设置断点if(!cap.isOpened())。但是,如果我尝试在Visual Studio 2012的当地人窗口来检查cap我得到的错误:

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

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

+1

调试符号在.pdb文件中。如果您有opencv_highgui246d.pdb,则将其复制到与DLL相同的文件夹中。如果你没有它,那么你需要构建DLL来获取符号文件。 –

回答

5
  • 问题:您正在使用的预生成林达来与2.4.6,你就可以调试自己的代码但你不能潜入OpenCV的库(如highgui246d .dll)。

  • 原因:需要未提供的PDB文件(想起来了,那会下载炸毁至技嘉范围)

  • 补救措施:如果你真的需要深入OpenCV的库,而调试,你将不得不重新编译它们(cmake和所有jive),因为这实际上会生成所需的pdb文件

+0

谢谢@berak;不用说,我无法说服OpenCV构建,但这是[另一个故事](http://stackoverflow.com/q/19439670/575530)。 – dumbledad

+0

是啊,只是看着它;) – berak

+0

我想我知道我在那里做错了 - 只是试着看看修复程序是否有效,但会议不断阻碍! – dumbledad

相关问题