微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

VSCode 是否可以在 Windows 7 上很好地调试代码?

如何解决VSCode 是否可以在 Windows 7 上很好地调试代码?

我在我的 windows7 上安装了 VSCode 和 MinGW-W64 并且想要运行 c/c++ 代码。但是在运行 hello 程序后,我发现它无法进入调试模式。下面是我从教程中复制的代码

hello.cpp:

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{

vector<string> msg {"Hello","C++","World","from","VS Code","and the C++ extension!"};

for (const string& word : msg)
{
    cout << word << " ";
}
cout << endl;

}

launch.jason:

{

"version": "0.2.0","configurations": [
  {
    "name": "C/C++: g++.exe build active file","type": "cppdbg","request": "launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","stopAtEntry": false,"customLaunchSetupCommands": [
      { "text": "target-run","description": "run target","ignoreFailures": false }
    ],"launchCompleteCommand": "exec-run","linux": {
      "MIMode": "gdb","miDebuggerPath": "/usr/bin/gdb"
    },"osx": {
      "MIMode": "lldb"
    },"windows": {
      "MIMode": "gdb","miDebuggerPath": "E:\\Program Files (x86)\\MingGW\\mingw64\\bin\\gdb.exe"
    }
  }
]

}

task.jason:

{

"version": "2.0.0","tasks": [
  {
    "type": "shell","label": "C/C++: g++.exe build active file","command": "g++","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],"options": {
      "cwd": "${workspaceFolder}"
    },"problemmatcher": ["$gcc"],"group": {
      "kind": "build","isDefault": true
    }
  }
]

}

我只在 vscode 中安装 c/c++ 扩展。安装时有什么我想念的吗?还是 VSCode 在 windows7 下能正常工作?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。