How do I convince Visual Studio to go through OpenCV source files while debugging?
Steps I've taken:
- Built OpenCV from source, so that I have the *d.pdb and *d.dll in the same folder (C:\OpenCV\bin)
- Added C:\OpenCV\bin to Tools -> Options -> Debugging -> Symbols. Note: I never got to see that it loads any pdb from this folder, but it doas load the pdbs from Microsoft's server.
- Added C:\OpenCV\bin to the system PATH variable, so that the executable has the libraries available at run time
- Added C:\OpenCV\modules to Solution's Property Pages -> Common Properties -> Debug Source Files (it looks like this would do the trick, but it doesn't)
- Added C:\OpenCV\install\include to Project's Property Page -> Configuration Properties -> C/C++ -> General -> Additional include directories, so that I can include OpenCV's header files, for this I had to also build the install project, which was not selected by default.
- Added C:\OpenCV\lib\Debug to Project's Property Page -> Configuration Properties -> Linker -> General -> Additional library directories, so that it knows where to look for .lib files
- Added all *d.lib files from C:\OpenCV\lib\Debug (where there are also some .pdb, by the way) to Project's Property Page -> Configuration Properties -> Linker -> Additional Dependencies, because otherwise apparently it doesn't know that I'd like to use everything in the folder I just specified previously.
Everything was done under Debug configuration.
The result is that I can build, I can debug, but if I step into some function, it gets me to the header file, instead of the source file, which is not very useful.
Does anyone know what did I miss to set up so I could go through OpenCV source files when I'm debugging my own project?
I run Visual Studio 2015 Community edition on Windows 10 if it has any importance...
It was possible before but for me it stopped working at OpenCV3.0. I am guessing it has something to do with the hidden implementation structure of the OpenCV classes.
that's quite bad. If there really is no solution debugging becomes impossible unless you have an actual error. How do you manage to do any work without this? Also it would be a lot easier to learn how OpenCV works and implicitly the concepts behind it, by going through the code.
I haven't got problems using VS2015 and opencv 3.1. I'm not working like you. I use CMake to build opencv and my own program. I don't install opencv and copy only dll in exe folder. I work with static lib too and i don't need to copy dll (except ffmpeg opencv dll) and I can debug in opencv source code. With vs 2015 2013 and 2012 professionnal edition I can debug opencv source code if source code is sync with dll.
Did you build with BUILDALL or the INSTALL? You have to build with INSTALL and set the environment variable to the install folder or copy the whole folder anywhere you like and set the variable to that path. Now you have to link your project against the lib folder and the include folder and copy the opencv dll('s) to your .exe folder. There is no need to link against the module folder. It should work fine this way.
that's what I did the first time, and unfortunately it did not work, that's why I proceeded with other things like what I described in my question. The thing is that after I did everything I described above and a few more other things (disabled optimization, etc) it started working somehow, but unfortunately I don't know exactly what did the trick. If I am to give some advice to anyone that has the same problem, is "keep trying" cause it's definitely working with the right incantation. When you start stepping into the code (F11), keep pressing it until you go over the headers, don't just assume that it's not working just because you've been through 10 headers already and there's no source code yet. Not really a good answer, but it might help someone...
@Eduardo, yes, did that, step 4 in my question.