Visual Studio Code
X
launch: program 'G:\cod\1.exe' does not exist
厂
打开"launchjson"取消
2条回答 默认 最新
关注
- 文章:vscode配置c语言环境以及launch:program“*****.exe” does not exist问题(保姆级检查) 中也许有你想要的答案,请看下吧
- 除此之外, 这篇博客: VS Code 问题:launch:program‘...\.vscode\launch.exe‘ dose not exist中的 解决过程 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
根据问题描述,查找 “launch:program’…vscode\launch.exe’ dose not exist” 相关解决办法。浏览众多博客,解决方式主要围绕在确认
launch.json
和tasks.json
的相关内容是否统一上,主要包括:- 确认
tasks.json
中的label
与launch.json
中的preLaunchTask
是否统一。此处的设置多种多样,只需要保证两者统一即可。参考博客3 - 将
tasks.json
文件中的command
设置为g++
。参考博客4。按照此前的配置博客配置后,我此处为"C:\\TDM-GCC-64\\bin\\g++.exe"
,指向g++
编译器。 - 修改
task.json
中args
和launch.json
中program
的设置,将${workspaceFloder}
修改为${fileBasenameNoExtension}
。参考博客5。
仔细查看了自己的配置文件,如下:
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "g++.exe - 生成和调试活动文件", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true,//弹出控制台窗口 "MIMode": "gdb", "miDebuggerPath": "C:\\TDM-GCC-64\\bin\\gdb.exe",//自己调试器位置 "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "C/C++: g++.exe build active file" } ] }
tasks.json
{ "version": "2.0.0", "tasks": [ { "type": "shell", "label": "C/C++: g++.exe build active file", "command": "C:\\TDM-GCC-64\\bin\\g++.exe", "args": [ "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "test", "isDefault": true } } ] }
c_cpp_properties.json
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "C:\\TDM-GCC-64\\bin\\gcc.exe", "cStandard": "c11", "cppStandard": "gnu++14", "intelliSenseMode": "gcc-x64" } ], "version": 4 }
确认三个文档的内容都没有问题。于是,又重新浏览了一边配置流程,发现一个问题:在配置
c_cpp_properties.json
之前,.cpp
文件就编译为了.exe
。所以问题不在配置文档中的设置,而在于编译器的选择。搜索 “VS Code无法将.cpp编译为.exe”,找到示好的博客。问题出在shell上。好吧,这一句 “Hello world !” 真难说出口。
- 确认
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用