-1

I have seen this question asked several times and I have tried all the nonsense that I have read, but I can't make it work.

I use Visual Studio 2012, in Debug mode. I compile the simple code

#include<iostream>
int main()
{
 std::cout << "Hi" << std::endl;
 system("pause");
 return 0;
}

I put a break-point in line 4 (std::cout...) and I press F5 to execute.

The break-point is ignored and there is an exclamation mark next to it saying that "The breakpoint will not currently be hit. No symbols have been loaded for this document".

EDIT: In the output window after building I get a warning:

main.obj : warning LNK4099: PDB 'vc110.pdb' was not found with 'main.obj' or at 'Z:\Projects\Tools\DebugTest\Debug\vc110.pdb'; linking object as if no debug info DebugTest.vcxproj -> Z:\Projects\Tools\DebugTest\Debug\DebugTest.exe

However, if I go to Properties > Configuration Properties > Linker > Debugging, in "Generate Program Database file" I believe I have the correct "$(OutDir)$(TargetName).pdb" so I don't understand why the pdb file is not being created.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Marc
  • 121
  • 5

2 Answers2

1
  • Try rebuild application.

  • Make sure it's in the debug configuration.

This can happen when the debug info files (.PDB) are out of sync with the real compiled binary.

kocica
  • 6,412
  • 2
  • 14
  • 35
  • I tried this and it doesn't work. Moreover, there are no pdb files anywhere. Shouldn't these be in the Debug folder? – Marc Aug 12 '17 at 20:30
  • Iam not sure if in debug folder, but in project folder there should be `.pdb` file. – kocica Aug 12 '17 at 20:32
  • In the output after building I get a warning: main.obj : warning LNK4099: PDB 'vc110.pdb' was not found with 'main.obj' or at 'Z:\Projects\Tools\DebugTest\Debug\vc110.pdb'; linking object as if no debug info DebugTest.vcxproj -> Z:\Projects\Tools\DebugTest\Debug\DebugTest.exe – Marc Aug 12 '17 at 20:37
  • Do you know how to fix this? – Marc Aug 12 '17 at 20:39
  • 1
    Found out this [link](https://stackoverflow.com/questions/25843883/how-to-remove-warning-lnk4099-pdb-lib-pdb-was-not-found) where is the solution of this problem, lets check it out. :-) – kocica Aug 12 '17 at 20:42
  • On that link, second answer, there is described what you have to do, with images, hope it will work after this. – kocica Aug 12 '17 at 20:51
  • When I build, a PDD file is created "Program Debug Database". By following the steps in the thread you mentioned, the PDD file is created in a different folder within the project, but the problem persists, and there is still no sign of a PDB file... – Marc Aug 12 '17 at 20:58
  • Hmmm interesting, iam going to sleep but ill check it tomorrow :-) – kocica Aug 12 '17 at 21:04
  • Thank you for your help by the way. – Marc Aug 13 '17 at 14:16
1

Here is how I made the breakpoints work, in case this helps anybody, although I don't really understand what I am doing.

In project properties > C/C++ > General, in Debug Information Format setting, I changed "program database" to "C7 compatible". Symbols are now loaded and breakpoints are hit.

It would be great if somebody could elaborate on why this causes the symbols to load, whereas the former option did not.

Marc
  • 121
  • 5