当前位置:网站首页>What's up with VS "Cannot find or open PDB file"?How to solve
What's up with VS "Cannot find or open PDB file"?How to solve
2022-08-01 09:31:00 【Love coldplay】
Sometimes, when we use VS (Visual Studio) to compile the program, there will be a prompt of "Cannot find or open the PDB file", and at this time, the program will fail to generate and cannot be run, as shown in the following figure:
#include#includeusing namespace std;int main(){vectorv1; // create an empty vector;vectorv2(5); //Create a vector with 5 elements;vectorv3(7, 3); //Create a vector with 7 elements and a value of 3vectorv4(v3); // copy constructorvectorv5(v3.begin(), v3.begin() + 3); //Copy the elements in the v3 range to v5// way 1cout << "1. The number of elements in v1:" << v1.size() << endl;cout << "2. v2 output: ";for (unsigned int i = 0; i < v2.size(); i++){cout << v2[i] << " ";}cout << endl;}
Don't panic, this kind of prompt is not a code error, but a problem with the compiler settings. Just change the settings and it will be OK.
Let's talk about what a PDB file is
When the program is compiled on VS, all dynamic link libraries (dll files) that the program depends on will also be compiled. During the compilation process, each dll will generate a pdb file, also known as a "symbol file", which is aAn information file that stores data, which contains some debugging information of the dll library during the compilation process, such as global variables, local variables, function names and their entry addresses used in the program.
The pdb file is mainly used to debug programs. It is mostly used when there are multiple projects in VS, and the projects are interdependent. Using the pdb file to debug the program often results in twice the result with half the effort. Beginners generally do not use it.arrive.
When using VS to debug a program, all pdb files generated by your program and the dll library that the program depends on will be loaded by default, but the result is often that VS cannot find the pdb file of the dependent library by itself, so it promptsYou "cannot find or open pdb file".
How to fix this error
We can make appropriate settings for VS to enable it to find the corresponding PDB file. The specific steps are as follows (here we take VS2017 as an example, and the operation steps of other versions of VS are the same).
1) Select "Debug --> Options" in the menu bar, as shown below:
2) After the "Options" dialog box pops up, select "Debugging --> General", and check "Enable source server support" in the option column on the right (the 3 sub-options included do not need to be checked), at this time, theA security alert box will pop up, select "Yes", as shown below:
3) Still in the "Options" dialog box, select "Debugging --> Symbols", and check "Microsoft Symbol Server" in the option bar on the right, a prompt dialog box will pop up, click "OK"That's it.At the same time, for the directory of cache symbols, select the directory in the illustration:
4) After confirmation, re-run your program. When running for the first time, it may wait for a few seconds because the compiler will load all the pdb files of the dynamic link library.After the program runs, the prompt "cannot find or open the pdb file" in the previous output window disappeared, as shown in the following figure:
As shown in the figure above, because the pdb file, also known as the "symbol file", the "symbol loaded", that is, the pdb file corresponding to the dynamic link library is successfully loaded.
边栏推荐
- How does UXDB return the number of records for all tables in the current database?
- 用OpenCV的边缘检测
- 【STM32】入门(二):跑马灯-GPIO端口输出控制
- Ogg synchronizes oracle to mysql, there may be characters that need to be escaped in the field, how to configure escape?
- 将aof文件转换为命令waoffle安装和使用
- MySQL query advanced - from the use of functions to table joins, do you remember?
- leetcode-6132:使数组中所有元素都等于零
- sqlserver怎么查询一张表中同人员的交叉日期
- Redis middleware (from building to refuse pit)
- 最新的Cesium和Three的整合方法(附完整代码)
猜你喜欢
How to implement deep copy in js?
Naive Bayes--Study Notes--Basic Principles and Code Implementation
various network protocols
走进音视频的世界——mp3封装格式
AC与瘦AP的WLAN组网实验
node 格式化时间的传统做法与高级做法(moment)
net stop/start mysql80 拒绝访问
The use of scrapy crawler framework
leetcode-6134: Find the closest node to the given two nodes
Microsoft Azure & NVIDIA IoT developers season I | Azure IoT & NVIDIA Jetson development foundation
随机推荐
HoloView——实时数据
杨辉三角(c语言实现)
【数据集】各类绝缘子、鸟巢及防震锤数据集汇总
毕业论文写作技巧
Comprehensive experiment BGP
XX市消防救援指挥中心实战指挥平台多链路聚合解决方案实例
Static Pod, Pod Creation Process, Container Resource Limits
2022.7.31-----leetcode.1161
leetcode-6134:找到离给定两个节点最近的节点
Parsing MySQL Databases: "SQL Optimization" vs. "Index Optimization"
Redis 3.2.3 crashed by signal: 11 服务宕机问题排查
The soul asks: How does MySQL solve phantom reads?
In the background of the GBase 8c database, what command is used to perform the master-slave switchover operation for the gtm and dn nodes
[Interview: Concurrency 39: Multithreading: Thread Pool] ThreadPoolExecutor Class - Submit, Stop
HoloView -- Tabular Datasets
leetcode-6132:使数组中所有元素都等于零
安装GBase 8c数据库的时候,报错显示“Resource,如何解决?
opencv创建窗口—cv.namedWindow()
AC与瘦AP的WLAN组网实验
leetcode-6134: Find the closest node to the given two nodes