MAC环境下 VS Code中C语言头文件导入错误

本文介绍了在MAC环境下使用VS Code时遇到C语言头文件导入错误的解决方案。通过查看gcc -v -E -x c++ 的输出找到头文件路径,并将其添加到c_cpp_properties.json的includePath中,解决了IntelliSense的警告。此外,还解决了xcrun错误,通过运行xcode-select --install命令安装缺失的 CommandLineTools。
摘要由CSDN通过智能技术生成

今天重新拾起了C语言,下载了vs code和CLion, 然后发现vs code写好代码之后头文件下方出现波浪线表示错误,百思不得其解。

然后看网上解答,找到了答案,好像是因为需要路径设置

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/Users/…/Desktop/ctest/main.c) will be provided by the Tag Parser.

解决方法是

在命令行里面输入gcc -v -E -x c++ -在结果里面找到头文件目录,

#include <…> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值