关于 VSCode C/C++ 插件的问题,只要把 includePath 和 compilerPath 在 setting.json 里改一下就能用了:
"C_Cpp.default.systemIncludePath": [
"/usr/local/include/**",
"/usr/local/include/c++/10.2.0/*",
"/Applications/
Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/tapi/12.0.0/include/**",
"/Applications/
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/**",
"/Applications/
Xcode.app/Contents/Developer/usr/lib/llvm-gcc/4.2.1/include/**",
"${workspaceFolder}/**"
],
"C_Cpp.default.macFrameworkPath": ["/Applications/
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"],
"C_Cpp.default.compilerPath": "/usr/bin/clang++",
"C_Cpp.default.intelliSenseMode": "macos-clang-arm64"
如果仅安装了 Xcode command-line tools,那 includePath 和 macFrameworkPath 的的路径需要改一下,不过大致都在
"/Library/Developer/CommandLineTools/" 下,如 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"