在网上找了好久找的答案都没用,自己试了好久终于弄出来了,哈哈哈,分享一下。
1.打开拓展
2.找到code runner,打开拓展设置
3.点击在json中编辑
将
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt && del $dir$fileNameWithoutExt.exe",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt && del $dir$fileNameWithoutExt.exe",
更改为
"c": "cd $dir && gcc *.c -o $fileNameWithoutExt && $dir$fileNameWithoutExt && del $dir$fileNameWithoutExt.exe",
"cpp": "cd $dir && g++ *.cpp -o $fileNameWithoutExt && $dir$fileNameWithoutExt && del $dir$fileNameWithoutExt.exe",
不过这样也有弊端,会把文件夹下的所有cpp都编译到一起。只能一个项目一个文件夹的写了。