Zlu*_*iie 7 c++ json compiler-errors visual-studio-code
我读到此错误是由于 launch.json 和tasks.json 文件中的某些设置造成的。所以我删除了它们并制作了新的,但它给出了相同的错误并且不会构建和调试。我如何解决它?
启动.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": "g++.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
]
}
Run Code Online (Sandbox Code Playgroud)
任务.json:
{
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
],
"version": "2.0.0"
}
Run Code Online (Sandbox Code Playgroud)
小智 7
就我而言,
.vscode
第一次调试时自动生成的文件夹F5
或 右上角Debug C/C++ File
)如果编译器有任何列表,则选择第一个。
99%这会起作用。否则尝试使用带有调试选项的在线 C++ 编译器,例如
https://www.onlinegdb.com/online_c++_compiler
小智 1
如果您之前编译过代码并且已经创建了可执行 (*.exe) 文件,请通过 VS Code 文件资源管理器将其删除,然后尝试再次构建代码。这就是问题所在,至少对我来说是这样。VS code 无法删除可执行文件来创建新的可执行文件。
归档时间: |
|
查看次数: |
54592 次 |
最近记录: |