I copied an existing project and renamed the folder. Now I get this error when I try to compile the application
debugging information cannot be found
I had a similar problem and the reason was that I had run one of the projects of my solution in a different process and that process couldn't be killed. I didn't think much of it. So when I was building the solution in a separate environment one of the pdb files didn't match so at the end I couldn't load any of the pdb files. I just restarted my computer and that fixed it.
Good luck
Right click on your project in the solution browser => Clean => Build. That is if your build generates a .pdb at all (look in your target dir) If not, you should enable debug by the steps mentioned in other posts
This problem has bothered me for a long time. AnT's anwser is very helpful. The main idea is Don't have any two pdb files have the same name, even they are not in the same directory.
This is my situation: I have tow projects name "FooBar" and "FooBarDll", the first one is an exe, and the second one is a dll. I set both projects Target Name to be "FooBar", so that they will generate "FooBar.exe" and "FooBar.dll" respectively.
Then I set
So I get these files:
Debug\FooBar\FooBar.pdb //Linker pdb
Debug\FooBar.dll
My solution is replacing every "TargetName" with "ProjectName", then I will get:
Debug\FooBar\FooBar.pdb //Linker pdb
Debug\FooBar.dll
Then there is no conflict!
Give C/C++ pdb a suffix may be better, like: "C/C++ -> Output Files -> Program Database File Name" to be "$(IntDir)$(ProjectName)_C.pdb"
I just encountered this error in VS2012. It is definitely caused by a bug in Visual Studio, which reveals itself in situations when the local PDB file of the main project has the same name as the final PDB file for the entire executable (even if the two are located in different directories!)
Consider this example.
Solution consists of three projects: main
, a
, and b
. main
is the top-level project for the executable, while a
and b
are libraries linked into main
.
In all three projects $(IntDir)
variable is set to $(SolutionDir)\$(Configuration)\$(ProjectName)\
. This means that project main
dumps its intermediate files to Debug\main\
, project a
- to Debug\a\
and so on.
In C/C++ -> Output Files
settings all three projects have Program Database File Name
value set to $(IntDir)$(TargetName).pdb
. This means that project main
generates its local PDB file as Debug\main\main.pdb
, project b
as Debug\b\b.pdb
and so on.
Finally, in Linker -> Debugging
settings of project main
the Generate Program Database File
value is set to $(OutDir)$(TargetName).pdb
. This means that the global PDB file for the entire executable will be generated as Debug\main.pdb
.
Note that in this setup each PDB file is generated in its own, separate directory.
In this setup you will get Debugging information cannot be found or does not match error if you attempt to run the program under the debugger. And if you take a look at the Debug\main.pdb
file (which will exist), you will notice that it is exactly the same as Debug\main\main.pdb
file! I.e. somehow the local PDB for main
managed to overwrite what was supposed to be the global PDB for the final executable. I.e. the debugger is right to complain that the PDB file is "wrong". It is indeed wrong.
Again, in the above setup the final global PDB somehow gets overwritten by local PDB of the top project. I don't know why it happens. It appears to be a bug. (Note that even though these PDB files have the same name, they are generated in different directories, i.e. they should not conflict.)
A workaround that fixes this issue is to give the local PDB of project main
a different name. For example, just go to C/C++ -> Output Files
for the main
project and change Program Database File Name
value to $(IntDir)$(TargetName)_local.pdb
(or to $(IntDir)12345.pdb
if you so desire). This will eliminate the conflict and solve the problem.
Enable PDB creation by:
Right click on MyProject > Properties > Debugging
:
C/C++ > General > Debug Information Output = Program Database (/Zi)
Linker > Debugging > Generate Debug Info = Yes (/DEBUG)
Clean MyProject, restart Visual Studio (just to be sure), rebuild MyProject. The output folder should then contain *.pdb files.
If you debug optimized/release code consider switching off optimization via
C++ > Optimization > Optmization = Disabled (/Od)
Most probably there are other reasons like .pdb / .exe file mismatch, something were not built / rebuilt, but I had similar case in Visual studio 2013 -
Something to do with virtual inline function - so I suspect.
In my case debugger were jumping in a middle of another C++ function, not the one which was called. Jump was off source code by 11 source code lines, but I cannot explain why much miscalculation happened. By simple rearranging functions I've got rid of this problem.
May be needs more detailed analysis why 11 lines shift happened originally.
Haven't seen this kind of behavior in any other visual studio.