Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/153.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法设置C++;VSCode中的调试;无法识别调试类型 我正试着让VSCode开始学习C++。作为这个部分的一部分,我需要调试代码,所以我已经安装了.v6文件的C/C++扩展,以便它添加C++调试配置。但是,当我尝试设置一个配置时,我不认为C++是环境的选择;仅限节点、gdb和lldb。按照说明,我没有看到任何命令C++中的调色板。因此,我手动设置任务、c_cpp_属性和launch.json文件,并根据需要复制、粘贴和修改路径。但是,VSCode将launch.json中的cppdbg标记为未识别为调试类型,将stopAtEntry、environments、MIMode和miDebuggerPath字段标记为“Property not allowed”。如果我将其更改为gdb,它将识别调试类型,但属性not allowed error仍然存在:_C++_Debugging_Visual Studio Code_Installation_Mingw W64 - Fatal编程技术网

无法设置C++;VSCode中的调试;无法识别调试类型 我正试着让VSCode开始学习C++。作为这个部分的一部分,我需要调试代码,所以我已经安装了.v6文件的C/C++扩展,以便它添加C++调试配置。但是,当我尝试设置一个配置时,我不认为C++是环境的选择;仅限节点、gdb和lldb。按照说明,我没有看到任何命令C++中的调色板。因此,我手动设置任务、c_cpp_属性和launch.json文件,并根据需要复制、粘贴和修改路径。但是,VSCode将launch.json中的cppdbg标记为未识别为调试类型,将stopAtEntry、environments、MIMode和miDebuggerPath字段标记为“Property not allowed”。如果我将其更改为gdb,它将识别调试类型,但属性not allowed error仍然存在:

无法设置C++;VSCode中的调试;无法识别调试类型 我正试着让VSCode开始学习C++。作为这个部分的一部分,我需要调试代码,所以我已经安装了.v6文件的C/C++扩展,以便它添加C++调试配置。但是,当我尝试设置一个配置时,我不认为C++是环境的选择;仅限节点、gdb和lldb。按照说明,我没有看到任何命令C++中的调色板。因此,我手动设置任务、c_cpp_属性和launch.json文件,并根据需要复制、粘贴和修改路径。但是,VSCode将launch.json中的cppdbg标记为未识别为调试类型,将stopAtEntry、environments、MIMode和miDebuggerPath字段标记为“Property not allowed”。如果我将其更改为gdb,它将识别调试类型,但属性not allowed error仍然存在:,c++,debugging,visual-studio-code,installation,mingw-w64,C++,Debugging,Visual Studio Code,Installation,Mingw W64,c_cpp_properties.json: { "configurations": [ { "name": "Win32", "includePath": ["${workspaceFolder}/**", "${vcpkgRoot}/x86-windows/include"], "defines": ["_DEBUG", "UNICODE", "_UNICODE"], "windowsSdkVersion": "10.0.17763

c_cpp_properties.json:

{
  "configurations": [
    {
      "name": "Win32",
      "includePath": ["${workspaceFolder}/**", "${vcpkgRoot}/x86-windows/include"],
      "defines": ["_DEBUG", "UNICODE", "_UNICODE"],
      "windowsSdkVersion": "10.0.17763.0",
      "compilerPath": "C:\\dev\\tools\\mingw64\\bin\\g++.exe",
      "cStandard": "c11",
      "cppStandard": "c++17",
      "intelliSenseMode": "${default}"
    }
  ],
  "version": 4
}
tasks.json:

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "build hello world",
        "type": "shell",
        "command": "g++",
        "args": ["test.cpp"],
        "group": {
          "kind": "build",
          "isDefault": true
        }
      }
    ]
  }
launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
      {
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/test.exe",
        "args": [],
        "stopAtEntry": true,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "console": true,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\dev\\tools\\mingw64\\bin\\gdb.exe"
      }
    ]
  }
我使用的VSCode版本较旧,为1.19。我编写代码的HelloWorld/test.cpp文件非常简单:

#include <iostream>
#include <string>

int main()
{
    std::cout << "Type your name" << std::endl;
    std::string name;
    std::cin >> name;
    std::cout << "Hello, " << name << std::endl;

    return 0;
}
#包括
#包括
int main()
{
std::cout名称;

std::cout我收到了相同的错误消息,结果我在launch.json文件中列出了两种不同的配置。我假设我在运行周期中只选择一种,一切正常。结果我不得不注释掉未使用的启动配置以消除错误消息。
(gdb)Launch
很好,注释掉整个Linux版本
lldb