C++: Unable to find or open PDB file?? How to solve it? And what is the cause?

C++: Unable to find or open PDB file?? How to solve it? And what is the cause?

Preface

Recently, when a blogger was writing C++, the code was obviously correct, but the compilation failed. After checking the reason, it was found that it showed: Unable to find or open the PDB file. (The solution will be introduced first, and the causes will be introduced later)
Insert image description here


Solution

Find in debuggingoption, double-click to findDebug optionOpen.
Next, find Start source server support in General Microsoft Symbol ServerCheck and confirm; FindSymbol a i=13> and just check it!

Insert image description here
__

reason

The PDB file (Program Database) contains debugging information about the program and is used to provide mapping of symbol information and source code during the debugging process. The problem of being unable to find or open PDB files may be due to the following reasons:

  1. Missing PDB file: If the PDB file is not generated during compilation or the PDB file is deleted, an error that cannot find or open the PDB file will occur. In the compilation options, make sure that the option to generate debug information is enabled (for example, using the /gd or /Zi options).
  2. The PDB file path is set incorrectly: Check the debugging options in the project settings to ensure that the correct PDB file path is specified. If the path is set incorrectly, Visual Studio will not be able to find or open the PDB file.
  3. PDB file does not match the source code: If the PDB file generated during compilation does not match the current source code file, it will also cause an error that the PDB file cannot be found or opened. This may be due to the source code file being changed and the PDB file not being regenerated. In this case, you can try rebuilding the entire solution to ensure that the PDB files match the source code files.
  4. Compiler options set incorrectly: Certain compiler options may affect the generation and access of PDB files. Check the compiler options in the project settings to ensure that no options related to PDB files have been disabled or changed.

Guess you like

Origin blog.csdn.net/Zhenyu_Coder/article/details/133958032