指定的参数超出了有效值的范围。

发布于 2025-01-24 08:13:43 字数 1246 浏览 0 评论 0原文

我正在运行 vscode c ++ Lenovo Legion 5 win 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.

I am running vscode for c++ on lenovo legion 5, win 10, and when trying to run a cpp by f5, I get an error:

"Unable to start debugging. Specified argument was out of the range of valid values.(Parameter 'arch')"

The launch json is:


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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扎心 2025-01-31 08:13:43

错误是告诉您发布的架构是不正确的。我认为,如果您不指定架构,则VSCODE会侵入体系结构,在这种情况下,它推断出的体系结构与您实际拥有的架构不符。

尝试添加:“ targetArchitecture”:“ your_architecture”,到配置。在联想中,我猜想您将ARM64作为您的体系结构,但是您可以检查系统信息以确保。

因此,例如,您可以将配置更改为:(

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

只要将目标体系结构放在配置中,只要它不在另一个字段中,就可以将目标体系结构放在何处。)

The error is telling you that the architecture of the launch is incorrect. I think that VSCode infers the architecture if you do not specify it, and in this case, the architecture that it inferred does not match what you actually have.

Try adding: "targetArchitecture": "YOUR_ARCHITECTURE", to the configuration. On a Lenovo, I am guessing that you have arm64 as your architecture, but you may check your system information to be sure.

So for example, you could change the configuration to look like:

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

(Where exactly you put the target architecture in the configuration should not matter as long as it is not inside another field.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文