Mac VScode C++开发环境配置
一 需要安装的模块
C/C++
C/C++ Clang Command Adapter
Code Runner
CodeLLDB
二 配置文件
c_cpp_properties.json
Ctrl + Shift + P,找到后点击,则会在工作目录中多出一个 .vscode 目录,进入,会有一个c_cpp_properties.json文件,我们就将要在这里面配置需要的头文件。
然后打开命令行,输入gcc -v -E -x c++ -
将上述得到的信息最下面的那些路径,添加到刚才vscode创建的c_cpp_properties.json中,如下所示,这样#include后面就不会出现红色波浪线了。
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include/**",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/**",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include/**",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/**",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/**",
"/Application

最低0.47元/天 解锁文章
2295

被折叠的 条评论
为什么被折叠?



