[英]Visual Studio Debugger C++ - breakpoints not recognized
初学者程序员在 Windows 10 上使用 Visual Studio 2021 年 1 月版。我还没有让断点工作。 在下面的 helloworld.cpp 程序中放置断点并运行调试器时,我收到以下消息并且没有设置断点。
断点警告:处理 helloworld.exe 时出现意外的符号读取器错误。 - c:\RetireRecipe\Simulator\helloworld.cpp:5
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
}
在我看来,我建议您可以尝试以下方法。
Debbug->(APP) Properties
,并使它们与Debug
一致。 断点操作只能在 Debug 模式下。 清理项目,重建项目并检查此文件夹Project Name\Debug
has.pdb 通过Right click your project ->Open Floder in File Explorer
。
Go Debug -> Options and Settings
。 在Debugging/General page
,清除Require source files that exactly match the original version
选项。
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
如果它仍然有效,我建议您可以重新安装 VS。
在阅读了几个小时的各种 VS Code 安装视频后,我最终重新安装了两次。 我的整体解决方案是重新安装并使用 g++ 编译器和 gdb 调试器。 我现在可以设置断点等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.