作者:送外卖转行计算机
来源:SegmentFault 思否
1.command + p, 然后输入 >C/C++
选择 编辑配置(JSON)
然后在工作区会出现一个.vscode文件夹, 其中会有一个.json文件的配置
2.打开命令行 输入
gcc -v -E -x c++ -
会有以下的信息
`ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks (framework directory)
End of search list.`
将上面的路径复制到刚刚的json文件中
如下图
{ "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**", "/usr/local/include/**", "/Library/Developer/CommandLineTools/usr/include/c++/v1/**", "/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include/**", "/Library/Developer/CommandLineTools/usr/include/**", "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/**", "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/**" ], "defines": [], "macFrameworkPath": [], "compilerPath": "/usr/local/bin/gcc-7", "cStandard": "gnu11", "cppStandard": "gnu++14", "intelliSenseMode": "clang-x64" }],"version": 4}
注意要在后面加 /**
然后红色波浪线就不会出现了。
End
经过了近一年时间的打磨,全球首本 VS Code 中文书,终于来了!想要学习更多 VS Code 的内容,欢迎阅读《Visual Studio Code 权威指南》。
更棒的是,《Visual Studio Code 权威指南》的新书签售会,将于 8 月 22 日举行!快来报名参与吧!
VS Code 黑宝书签售会,来啦!相约 8月22日