繁体   English   中英

Visual Studio 调试器 C++ - 无法识别断点

[英]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;
}

在我看来,我建议您可以尝试以下方法。

  1. Select Debbug->(APP) Properties ,并使它们与Debug一致。 断点操作只能在 Debug 模式下。

在此处输入图像描述

  1. 清理项目,重建项目并检查此文件夹Project Name\Debug has.pdb 通过Right click your project ->Open Floder in File Explorer 在此处输入图像描述

  2. Go Debug -> Options and Settings Debugging/General page ,清除Require source files that exactly match the original version选项。 在此处输入图像描述 在此处输入图像描述

  3. Debug -> (app) Properties-> Configuration Properties -> Debugging -> change from Auto to Mixed 在此处输入图像描述

  4. 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM