乐趣区

关于visual-studio-code:vscode-c-编译可以通过-但是有红色波浪线的问题

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

}

留神要在前面加 /**

而后红色波浪线就不会呈现了。

退出移动版