赞
踩
安装好必要的插件后(如C/C++,code runner等)默认生成task.json即可进行单文件运行
涉及到多文件情况可以修改task.json如下:
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe 生成活动文件", "command": "D:\\mingw64\\mingw64\\bin\\g++.exe",//g++.exe路径 "args": [ "-fdiagnostics-color=always", "-g", "${workspaceFolder}\\*.cpp",//这里修改为现在的所有cpp文件参与构建 "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe", ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "编译器: \"D:\\mingw64\\mingw64\\bin\\g++.exe\""//g++.exe路径 } ] }
除此方法还可使用cmake构建
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。