【问题标题】:Specified argument was out of the range of valid values.(Parameter 'arch')指定的参数超出了有效值的范围。(参数 \'arch\')
【发布时间】:2022-10-01 02:03:27
【问题描述】:

我在跑步代码为了C++联想军团5,赢得 10,并且在尝试通过 f5 运行 cpp 时,出现错误:

\"无法开始调试。指定的参数超出了有效值的范围。(参数\'arch\')\"

启动 json 是:


    \"configurations\": [
        {
            \"name\": \"C++ Launch\",
            \"type\": \"cppdbg\",
            \"request\": \"launch\",
            \"program\": \"${workspaceFolder}/main.cpp\",
            \"environment\": [],
            \"args\": [],
            \"stopAtEntry\": false,
            \"externalConsole\": true,
            \"MIMode\": \"gdb\",
            \"cwd\": \"${workspaceFolder}\",
            \"customLaunchSetupCommands\": [
              { \"text\": \"target-run\", \"description\": \"run target\", \"ignoreFailures\": false }
            ],
            \"launchCompleteCommand\": \"exec-run\",
            \"linux\": {
              \"MIMode\": \"gdb\",
              \"miDebuggerPath\": \"C:\\\\msys64\\\\mingw64\\\\bin\\\\gdb.exe\"
            },
            \"osx\": {
              \"MIMode\": \"lldb\"
            },
            \"windows\": {
              \"MIMode\": \"gdb\",
              \"miDebuggerPath\": \"C:/MinGw/bin/gdb.exe\"
            }
          }
        
    ]
}```

I\'m a beginner so I don\'t really know why this is happening.

    标签: c++ visual-studio-code gdb


    【解决方案1】:

    该错误告诉您启动的体系结构不正确。我认为如果您不指定,VSCode 会推断架构,在这种情况下,它推断的架构与您实际拥有的架构不匹配。

    尝试在配置中添加:"targetArchitecture": "YOUR_ARCHITECTURE",。在联想上,我猜你有arm64 作为你的架构,但你可以检查你的系统信息来确定。

    例如,您可以将配置更改为如下所示:

    ...
    "MIMode": "gdb",
    "targetArchitecture": "arm64",
    "cwd": "${workspaceFolder}",
    ...

    (只要它不在另一个字段中,您将目标架构放在配置中的确切位置并不重要。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多