“未解决的包含"C 标准库头文件的 Eclipse CDT 错误 [英] "Unresolved inclusion" error with Eclipse CDT for C standard library headers

查看:38
本文介绍了“未解决的包含"C 标准库头文件的 Eclipse CDT 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为 Eclipse 设置了 CDT 并编写了一个简单的 hello world C 程序:

I set up CDT for eclipse and wrote a simple hello world C program:

#include <stdio.h>

int main(void){
    puts("Hello, world.");
    return 0;
}

程序构建并正确运行,但 Eclipse 在包含语句旁边显示这个黄色问号,上面写着 "Unresolved包含:<stdio.h>>>>>> 当我把鼠标放在超过它.

The program builds and runs correctly, but eclipse keeps showing this yellow question mark by the side of inclusion statement that says "Unresolved inclusion: <stdio.h>" when I put mouse over it.

它不影响程序的运行,但我觉得它很烦人.

It doesn't affect running of the program but I find it rather annoying.

有人知道如何删除它吗?

Does anyone have any idea how to remove it?

推荐答案

Eclipse 使用的编译器能够很好地解析符号,因此代码可以很好地编译.

The compiler Eclipse is using is able to resolve the symbols just fine, so the code will compile fine.

但是 Eclipse 使用的代码完成/索引器或预处理器不知道 stdio.h 存在于何处.

But the code-completion/indexer or preprocessor Eclipse is using doesn't know where stdio.h exists.

您需要指定stdio.h所在的文件系统路径.

You need to specify the filesystem path where stdio.h is located.

Eclipse 文档在编译器的几个部分中对此进行了描述:

The Eclipse documentation describes this in several sections for the compiler:

如果代码完成/索引器或预处理器也找不到stdio.h:

And if the code-completion/indexer or preprocessor specifically also cannot locate stdio.h:

stdio.h 的确切位置将取决于您打算为其编写代码的系统.如果您正在为运行 Eclipse 的同一系统编写代码,那么对于 Linux、macOS、Cygwin 等,标准位置是 /usr/include/stdio.h.

The exact location of stdio.h will depend on the system you are intending to write the code for. If you are writing code for the same system you are running Eclipse on, then the standard location is /usr/include/stdio.h for Linux, macOS, Cygwin, etc.

如果您为单独/远程目标系统(例如 Android、Raspberry Pi、STM32)进行交叉编译,那么它将位于您为该系统安装的 SDK 中的某个位置.您需要参考该特定 SDK 文档.

If you are cross-compiling for a separate/remote target system (e.g. Android, Raspberry Pi, STM32), then it will be located somewhere in the SDK you installed for that system. You will need to refer to that particular SDK documentation.

这篇关于“未解决的包含"C 标准库头文件的 Eclipse CDT 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆