Eclipse C / C ++(CDT)将文件导入项目 - 未找到头文件 - 包含路径 [英] Eclipse C/C++ (CDT) import files into project - header file not found - include path

查看:1146
本文介绍了Eclipse C / C ++(CDT)将文件导入项目 - 未找到头文件 - 包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文件导入Eclipse C项目并对其进行编译。构建过程找不到本地头文件。头文件位于src目录中。如何在eclipse中编辑包含路径?如果我手动执行,我可以在gcc中指定-I选项。

I am trying to import files into an Eclipse C project and compile it. The build process cannot find the local header files. The header files are located in the src directory. How can I edit the include path in eclipse? If I were doing it manually I could specify the -I option in gcc.

Building file: ../src/averaging.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/averaging.d" -MT"src/averaging.d" -o"src/averaging.o" "../src/averaging.c"
../src/averaging.c:2:23: fatal error: averaging.h: No such file or directory
compilation terminated.
make: *** [src/averaging.o] Error 1


推荐答案


  1. 右键单击项目并选择属性。

  2. 选择C / C ++常规 - >路径和符号。

  3. 选择包括标签

  4. 在语言列表中,选择GNU C或您使用的任何C编译器工具链。

  5. 按添加...按钮,并添加包含文件的目录。

  6. 关闭属性窗口并重建。您应该在构建过程中看到新路径被用作 -I

  1. Right click on the project and select properties.
  2. Select C/C++ General -> Path and Symbols.
  3. Select Includes tab.
  4. In Languages list, select 'GNU C' or whatever C compiler tool chain you use.
  5. Press 'Add...' button and add the directory for the include files.
  6. Close Properties window and rebuild. You should see new path being used as -I in build process.

这篇关于Eclipse C / C ++(CDT)将文件导入项目 - 未找到头文件 - 包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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