debugging information cannot be found or does not match visual studio's

后端 未结 14 1725
醉酒成梦
醉酒成梦 2020-11-29 04:11

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

14条回答
  •  时光说笑
    2020-11-29 04:57

    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

    1. "General -> Intermediate Directory" to be "$(OutDir)\$(ProjectName)\"
    2. "C/C++ -> Output Files -> Program Database File Name" to be "$(IntDir)$(TargetName).pdb"
    3. "Linker -> Debugging -> Generate Program Database File" to be "$(OutDir)$(TargetName).pdb"

    So I get these files:

    1. Debug\FooBar.exe
    2. Debug\FooBar.pdb //C++ pdb
    3. Debug\FooBar\FooBar.pdb //Linker pdb

    4. Debug\FooBar.dll

    5. Debug\FooBar.pdb // C++ pdb again!
    6. Debug\FooBarDll\FooBar.pdb // Linker pdb

    My solution is replacing every "TargetName" with "ProjectName", then I will get:

    1. Debug\FooBar.exe
    2. Debug\FooBar.pdb //C++ pdb
    3. Debug\FooBar\FooBar.pdb //Linker pdb

    4. Debug\FooBar.dll

    5. Debug\FooBarDll.pdb // C++ pdb
    6. Debug\FooBarDll\FooBarDll.pdb // Linker pdb

    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"

提交回复
热议问题