vscode 编译c++文件无法生成.exe文件的问题解决方法

您所在的位置:网站首页 vscode生成exe vscode 编译c++文件无法生成.exe文件的问题解决方法

vscode 编译c++文件无法生成.exe文件的问题解决方法

2023-08-31 18:34| 来源: 网络整理| 查看: 265

vscode 编译c++文件无法生成.exe文件的问题解决方法

小编本想使用vscode进行代码编写,感受一下高口碑的自定义编译工具,没想到写了个hello world却编译不出二进制文件进行调试。 思来想去,倒腾了一个多小时就在快要放弃,准备用插件凑合过日子的时候发现了问题的根本原因: 竟然是shell工具的问题!

以下为我写的代码:

#include #include using namespace std; int main () { int s = 10; while (s "tasks": [ { "type": "shell", "label": "C/C++: g++.exe build active file", "command": "D:\\vscode\\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" }

g++路径是对的,编译选项没什么问题。

去cmd窗口下自己用命令敲一遍,编译的出二进制!

后来终于想到可以配置shell,F1调出命令窗,输入shell,选择默认shell为cmd.exe 在这里插入图片描述 接下来就可以编译出二进制了。调试无压力。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3