指定的参数超出了有效值的范围。
我正在运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误是告诉您发布的架构是不正确的。我认为,如果您不指定架构,则VSCODE会侵入体系结构,在这种情况下,它推断出的体系结构与您实际拥有的架构不符。
尝试添加:
“ targetArchitecture”:“ your_architecture”,
到配置。在联想中,我猜想您将ARM64
作为您的体系结构,但是您可以检查系统信息以确保。因此,例如,您可以将配置更改为:(
只要将目标体系结构放在配置中,只要它不在另一个字段中,就可以将目标体系结构放在何处。)
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 havearm64
as your architecture, but you may check your system information to be sure.So for example, you could change the configuration to look like:
(Where exactly you put the target architecture in the configuration should not matter as long as it is not inside another field.)