使用vscode调试一段代码,按下f5调试后就出现这个对话框了,生成不了.exe文件。
找了很多内容,都无法解决。所有路径中均不涉及中文字符。
看大家的意思好像都说问题出在launch.json文件上,但是调了很多次仍然会弹出相同对话框
附上:
launch.json:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe - 生成和调试活动文件",
"type": "cppdbg",
"program": "${workspaceFolder}\\${fileBasenameNoExtension}.exe",
"request": "launch",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\My_computer\\D\\MinGW64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask":"C/C++: gcc.exe 生成活动文件",
}
]
}
task.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "C:\\My_computer\\D\\MinGW64\\bin\\gdb.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${workspaceFolder}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
},
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "C:\\My_computer\\D\\CX\\Microsoft VS Code\\MinGW64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${workspaceFolder}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "编译器: \"C:\\My_computer\\D\\CX\\Microsoft VS Code\\MinGW64\\bin\\gcc.exe\""
}
],
"version": "2.0.0"
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"C://My_computer//D//MinGW64//x86_64-w64-mingw32//include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64",
"compilerPath": ""
}
],
"version": 4
}
由于自己第一次接触vscode,不是很清楚json文件里的语法规则,大家可以不用讲的那么深(当然细讲的话更好啦),直接说解决措施,让写好的c代码正常运行就可以。如果还需要提供什么信息就说一下。多谢啦。
https://blog.csdn.net/weixin_44605210/article/details/108402167
打开所在文件夹,把 launch.json删除后就可以生成了,但不知道为什么