vscode c++ 編譯可以通過 但是有紅色波浪線的問題

2020-07-31     segmentfault官方

原標題:vscode c++ 編譯可以通過 但是有紅色波浪線的問題

作者:送外賣轉行計算機

來源: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 }

注意要在後面加 /**

然後紅色波浪線就不會出現了。

文章來源: https://twgreatdaily.com/zh-mo/3N7mp3MBd8y1i3sJ2-wR.html

Flutter 知識點

2020-08-10