eclipse - unresolved inclusion: <stdio.h>

eclipse上配置好cdt后,新建一个简单的项目测试下,当写入头文件时,却出现如下错误提示:

unresolved inclusion: <stdio.h>

原因与解决:

这是c/c++标准库未设置所致。解决方法如下。

选中项目,依次操作:

右键单击 -> properties -> C/C++ General -> Paths and Symbols -> Add…  -> file system.

然后选择c/c++库的位置:/usr/include

如此再继续添加/usr/include/c++路径。确定后即可

参考:

Eclipse reports Unresolved inclusion for system headers such as stdio.h if it cannot locate the header files for a project. You can resolve this by right-clicking on the project in the Project Explorer view and then selecting Properties… from the context menu. In the dialog box, select: C/C++ General → Paths and Symbols → Add… and then add the path to the ARM Compiler headers on your host workstation. For example, C:Program FilesDS-5include. Select both Add to all configurations and Add to all languages, click on Apply so that Eclipse can rebuild the index.
 

点赞 (1)
  1. 任侠001说道:

    Windows-->Preferences-->C/C++找到Environment。增加两个变量:

    CPLUS_INCLUDE_PATH: /usr/include/c++/4.1.3(我的gcc版本)

    C_INCLUDE_PATH: /usr/include

发表评论

电子邮件地址不会被公开。 必填项已用*标注