locked
Problem using PDB with native C++ Visual Studio 2012 RRS feed

  • General discussion

  • I have two separate team projects in native C++, the main project and a core library used by this project.

    I use a build server to build both projects. The problem is that the main project is not able to find the pdb file of the core library.

    Below is what I’m currently doing:

    1-      Setting for the core project:

      • In the properties, under C++ / Output Files / Program DataBase File Name: $(OutDir)$(TargetName).pdb
      • I use the /ZI option

    The core project creates the lib and the associate pdb file.

    I build this project on a dedicated build server and I want to use the library and PDB file for debugging the main project on my development PC. I copy both library and PDB file to my local computer in the same directory.

    2-      Setting for the main project

    1. When I link the project with the core library, it does not find the associate PDB of my library.
    2. I tried putting the directory where I copied the pdb and lib in the Visual Option Debugging Symbols è  Same problem
    3. I tried to put the PDB in the debug directory of my main project è This works, however I would like to have the PDB in a dedicated location, not in the debug directory
    4. I tried to get the core library project on my computer, build it and compile lib and PDB è This works however, I want to have the lib and PDB build on the server, not locally.

    Am I missing any settings or doing something wrong?

    Thanks,

    Monday, October 8, 2012 9:35 AM

All replies

  • Hi Sylvain,

    I use a build server to build both projects.

    Just to make this issue clearly, do you mean that you are using the TFS-Build? If so, I suggest you try to build your app with MSBuild locally, since the TFS-build will call it. And then debug your app locally.

    Could you share us the detailed error message when you debug your app locally? Do you mean that you get the message like “Cannot find or open the PDB file”?

    If you get the above message, I suggest you check the symbol loaded. By default, the debugger loads symbol files from the location where your EXE is located. To use symbols from another directory or a symbol server, you must specify the locations to Visual Studio. For detailed information, see How to: Specify Symbol Locations and Loading Behavior.

    Reference:

    C++: "Cannot find or open the PDB file"

    Cannot find or open the PDB file

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, October 9, 2012 3:09 AM
  • Hi Jack,

    Yes, I use TFS Build.

    I have the following warning during the link:

    warning LNK4099: PDB 'Libd.pdb' was not found with 'Project.lib(File.obj)' or at 'C:\Project\Debug\Libd.pdb'; linking object as if no debug info

    Thanks,

    Tuesday, October 9, 2012 8:56 AM
  • Hi Sylvain,

    Glad to receive your reply.

    warning LNK4099: PDB 'Libd.pdb' was not found with 'Project.lib(File.obj)' or at 'C:\Project\Debug\Libd.pdb'; linking object as if no debug info

    So you get this warning when you build it locally, am I right? Anyway, I’m afraid that it is not the VS debugger issue.

    I did some research about this warning, I find the MSDN document.

    PDB 'filename' was not found with 'object/library' or at 'path'; linking object as if no debug info

    The linker was unable to find your .pdb file. Copy it into the directory that contains object/library.

    To find the name of the .pdb file associated with the object file:

      • Extract an object file from the library with lib /extract:objectname.obj xyz.lib.
      • Check the path to the .pdb file with dumpbin /section:.debug$T /rawdata objectname.obj.

    You could also compile with /Z7, so the pdb doesn't need to be used, or remove the /DEBUG linker option if you do not have .pdb files for the objects you are linking.

    I also get a similar thread in the VC++ forum, see “LNK4099 problem”. Hope it could help.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 10, 2012 2:27 AM
  • Hi Jack,

    Yes, this helps for the investigation.

    I did what you suggested and I can see that the path in the obj file integrated in my static library is hard coded and has the path of where it was build (C:\...\Library\Debug\libd.pdb). Therefore If I have it at this location, I don't have the warning anymore. However I would like to have it somewhere else on my computer. Why is the path hard coded? Is there an hidden option to have this path relative in order to have both lib and pdb in the same directory?

    Thanks,

    Wednesday, October 10, 2012 12:41 PM
  • Hi Sylvain,

    Glad to receive your reply.

    I didn’t find more information to change the path. As far as I know, it seems that it is the default path to save the .pdb file. But like this document when we debug the apps which need to load some third-party or system DLLs you have to debug. Symbol files can be stored in a directory on your computer or downloaded from a symbol server.

    Since it is not the VS debugger issue, maybe you could get some information for this issue in the MSBuild forum.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, October 11, 2012 3:10 AM