[英]Visual Studio Debugger C++ - breakpoints not recognized
Beginner programmer using Visual Studio release January 2021 on Windows 10. I have yet to get breakpoints to work.初学者程序员在 Windows 10 上使用 Visual Studio 2021 年 1 月版。我还没有让断点工作。 When placing a breakpoint in the helloworld.cpp program below and running the debugger, I get the following message and no breakpoint is set.
在下面的 helloworld.cpp 程序中放置断点并运行调试器时,我收到以下消息并且没有设置断点。
Breakpoint warning: Unexpected symbol reader error while processing helloworld.exe.断点警告:处理 helloworld.exe 时出现意外的符号读取器错误。 - c:\RetireRecipe\Simulator\helloworld.cpp:5
- c:\RetireRecipe\Simulator\helloworld.cpp:5
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
}
In my opinion, I suggest that you could try the following methods.在我看来,我建议您可以尝试以下方法。
Debbug->(APP) Properties
, and make suer they are consistent and Debug
. Debbug->(APP) Properties
,并使它们与Debug
一致。 Breakpoint operation can only be in Debug mode. Clean the project, rebuild the project and check if this folder Project Name\Debug
has.pdb by Right click your project ->Open Floder in File Explorer
.清理项目,重建项目并检查此文件夹
Project Name\Debug
has.pdb 通过Right click your project ->Open Floder in File Explorer
。
Go to Debug -> Options and Settings
. Go
Debug -> Options and Settings
。 On the Debugging/General page
, clear the Require source files that exactly match the original version
option.在
Debugging/General page
,清除Require source files that exactly match the original version
选项。
Debug -> (app) Properties-> Configuration Properties -> Debugging -> change from Auto to Mixed
. Debug -> (app) Properties-> Configuration Properties -> Debugging -> change from Auto to Mixed
。
Configuration Properties -> Linker -> Debugging -> Generate Debug Info -> Generate Debug Information optimized for sharing and publishing
If it still work, I suggest that you could reinstall VS.
如果它仍然有效,我建议您可以重新安装 VS。
After several hours of reading various VS Code install videos, I ended up reinstalling twice.在阅读了几个小时的各种 VS Code 安装视频后,我最终重新安装了两次。 The overall solution for me was the reinstall and using the g++ compiler and gdb debugger.
我的整体解决方案是重新安装并使用 g++ 编译器和 gdb 调试器。 I can now set breakpoints, etc.
我现在可以设置断点等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.