博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[解决]VSCode在Linux下导入c语言头文件警告
阅读量:3914 次
发布时间:2019-05-23

本文共 892 字,大约阅读时间需要 2 分钟。

VSCode导入#include <stdio.h>文件时提示以下错误:

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/wk/c01/main.c) will be provided by the Tag Parser.cannot open source file "stddef.h" (dependency of "stdio.h")

这是由于配置中没有指定依赖路径导致的,在c_cpp_properties.json中includePath的默认配置只有当前目录,需要将系统依赖加入。

在命令行里面输入 gcc -v -E -x c++ - 在结果里面找到头文件目录,然后添加到includepath中。

注意,这里根据 VS code 操作的是LInux 和 Windows下的文件会有所不同,解决办法不一样

对于使用 VScode 连接Linux,操作Linux下的C++文件出现这个问题的解决办法是:

在terminal 中输入 gcc -v -E -x c++ - ,然后将最下的路径复制到 c_cpp_properties.json中 includePath下

如果输入上面的命令后提示 gcc 命令不存在,那说明当前Linux还有安装gcc, 那应该先输入下面的命令安装gcc, 然后输入上面的命令

yum -y install gcc gcc-c++ kernel-devel //安装gcc、c++编译器以及内核文件

配置好的 c_cpp_properties.json 文件如下:

如果你是用 VS code 遍历windows下的c++文件,然后出现这个问题

那么应该先按快捷键 Win + R, 然后输入 cmd, 在命令行窗口中输入 gcc -v -E -x c++ -

然后复制最下面的路径到 c_cpp_properties.json中 includePath下即可

文章参考:

转载地址:http://jidrn.baihongyu.com/

你可能感兴趣的文章
Delete Last Element
查看>>
Python list reverse
查看>>
Level Order Tree Traversal
查看>>
Python hashmap
查看>>
python 切片
查看>>
interview sum
查看>>
HTTPs Control
查看>>
Prenatal Vitamin Brands
查看>>
Python sort list customisation
查看>>
Python sort dict by value
查看>>
ASCII - American Standard Code for Information Interchange
查看>>
Django short url
查看>>
Tech Blog
查看>>
Logon System Design
查看>>
Python yield
查看>>
Sina API OAuth
查看>>
Python supervisor
查看>>
dict & set
查看>>
Common Multiple and Least Common Multiple(LCM)
查看>>
大数据处理
查看>>