C++:在VSCode中生成预处理文件



构建任何c/c++代码都会生成.exe文件。有没有办法为ex.preprocessed.txt生成另一个文件,其中包含预处理的代码?tasks.json中有什么需要修改的吗?

这是我通常使用的json文件:

{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\Program Files\CodeBlocks\MinGW\bin\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}\*.cpp",
"-o",
"${fileDirname}\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: "C:\Program Files\CodeBlocks\MinGW\bin\g++.exe""
}
]
}

添加-E而不是-o不会生成.i文件,但会在终端中生成预处理的代码。。

最新更新