将 header 添加到项目设置中的每个文件 (gcc -include)
Add header to every file in project setting (gcc -include)
我有一个使用 gcc -include file.h
的项目
正如 gcc 文档所说,这确保 file.h 包含在每个以这种方式编译的文件中(这意味着每个其他文件中都有 #include "file.h")。
现在我已将这个项目导入到 eclipse 中,并在该文件所在的位置设置了包含路径,但无法弄清楚如何在 eclipse 项目设置中执行类似 gcc -include 的操作。这样做的结果是,在编辑器中我有很多“无法解析符号 xy”,但项目编译得很好。
感谢您的帮助。
您可以在 project-by-project 的基础上更改 CDT GCC Built-in Compiler Settings
。
- 转到
Project
-> Properties
-> C/C++ General
-> Preprocessor Include Paths, Macros etc.
- Select
Providers
选项卡。
- Select
CDT GCC Built-in Compiler Settings
- 取消选择
Use global provider shared between projects
- 将所需的 GCC 标志添加到
Command to get compiler specs:
输入框
(见下图中突出显示的文字)
您可能想要单击 Store entries in project settings folder
我有一个使用 gcc -include file.h
的项目正如 gcc 文档所说,这确保 file.h 包含在每个以这种方式编译的文件中(这意味着每个其他文件中都有 #include "file.h")。
现在我已将这个项目导入到 eclipse 中,并在该文件所在的位置设置了包含路径,但无法弄清楚如何在 eclipse 项目设置中执行类似 gcc -include 的操作。这样做的结果是,在编辑器中我有很多“无法解析符号 xy”,但项目编译得很好。
感谢您的帮助。
您可以在 project-by-project 的基础上更改 CDT GCC Built-in Compiler Settings
。
- 转到
Project
->Properties
->C/C++ General
->Preprocessor Include Paths, Macros etc.
- Select
Providers
选项卡。 - Select
CDT GCC Built-in Compiler Settings
- 取消选择
Use global provider shared between projects
- 将所需的 GCC 标志添加到
Command to get compiler specs:
输入框
(见下图中突出显示的文字)
您可能想要单击 Store entries in project settings folder