在项目设置中为每个文件添加标题(gcc -include)

Jan*_*Jan 5 c++ eclipse ide gcc eclipse-cdt

我有一个使用gcc -include file.h的项目

正如gcc文档所说,这确保了file.h包含在以这种方式编译的每个文件中(意味着在每个其他文件中都有#include"file.h").

现在我已经将这个项目导入到eclipse中,并且我设置了该文件所在的包含路径,但无法弄清楚如何在eclipse项目设置中执行类似gcc -include的操作.结果是在编辑器中我有很多" 符号xy无法解决 ",但项目编译得很好.

谢谢你的帮助.

Ste*_*mer 2

CDT GCC Built-in Compiler Settings您可以根据项目进行更改。

  • 转到Project-> Properties-> C/C++ General->Preprocessor Include Paths, Macros etc.
  • 选择Providers选项卡。
  • 选择CDT GCC Built-in Compiler Settings
  • 取消选择Use global provider shared between projects
  • 将所需的 GCC 标志添加到Command to get compiler specs:输入框中

(参见下图中突出显示的文字)

在此输入图像描述

您可能想点击Store entries in project settings folder