Problem: cannot open source file "header.h"
- VSCode Version: 1.31.1
- OS Version: Mac OS X 10.14.2(command line:~ $ sw_vers 查看系统版本号)
- VSCode-cpptools Version: 0.21.0
(~ code --list-extensions --show-versions)
方法:
打开Mac command line 输入命令
~ $ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
在c_cpp_properties.json 文件"includePath"节点 添加路径
“/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include”