0

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. 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)\$(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)\

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;

but I am opening a file

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

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:

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

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?

dumbledad
  • 16,305
  • 23
  • 120
  • 273
  • 1
    The debug symbols are in .pdb files. If you have opencv_highgui246d.pdb then copy it to the same folder as the DLL. If you don't have it then you need to build the DLL to get the symbol file. – ScottMcP-MVP Oct 17 '13 at 20:42

1 Answers1

4
  • 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 ).

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

  • 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

berak
  • 39,159
  • 9
  • 91
  • 89
  • Thanks @berak; needless to say I cannot persuade OpenCV to build but that is [another story](http://stackoverflow.com/q/19439670/575530). – dumbledad Oct 18 '13 at 00:41
  • yea, just looking at it ;) – berak Oct 18 '13 at 09:15
  • I think I know what I did wrong there - just trying it out to see if the fix works, but meetings keep getting in the way! – dumbledad Oct 18 '13 at 10:02
  • @berak Hi ! actually I am also having the same broblem `opencv_world300d.dll'. Cannot find or open the PDB file` Do I need to build **OpenCV** from sources. –  Jul 07 '16 at 07:36