rmf*_*low 6 c++ visual-studio-code
我知道可以在 c_cpp_properties.json 中为 Visual Studio Code 添加定义并且我手动__GNUC__为我的代码定义,但是是否可以撤消/删除 Visual Studio Code 为自己假设的定义?例如,如果我设置intelliSenseMode为clang-x64宏__clang__被定义,这完全破坏了我的智能感知,因为我没有合适的包含文件用于我使用的库并且包含选择__clang__发生在__GNUC__. msvc-x64价值相同。如果我手动#undef __clang__在我的包含文件中,那么一切都是完美的。
是否可以在 Visual Studio Code 配置中撤消宏?
首先,创建一个名为vscode-preinclude.h. 把它放在任何地方;我会假设它在工作区文件夹中(其中也有一个.vscode)。在该文件中用于#undef取消定义您需要关闭的符号。例子:
#undef __clang__
Run Code Online (Sandbox Code Playgroud)
接下来,使用命令面板 (Ctrl+Shift+P) 并打开“C/C++: Edit Configurations (UI)”。转到底部并打开“高级设置”。向下滚动到“强制包含”,并添加一行:
${workspaceFolder}/vscode-preinclude.h
Run Code Online (Sandbox Code Playgroud)
就是这样!
如果它不起作用,请查看“C/C++:日志诊断”命令的输出。它应该显示如下内容:
${workspaceFolder}/vscode-preinclude.h
Run Code Online (Sandbox Code Playgroud)
在其输出中。
| 归档时间: |
|
| 查看次数: |
1421 次 |
| 最近记录: |