将头文件添加到 C++ 的 Eclipse 构建路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15935207/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 19:55:19  来源:igfitidea点击:

Adding header files to eclipse build path for C++

c++eclipseincludeeclipse-cdt

提问by Matt M

I'm trying to use this: http://www.minixml.org/index.php

我正在尝试使用这个:http: //www.minixml.org/index.php

I'd like to get these includes to work on Eclipse for Windows.

我想让这些包含在 Eclipse for Windows 上工作。

Can anybody help me?

有谁能够帮助我?

回答by Alexander Shukaev

Left-click your project and choose Properties, then go to the following section: C/C++ General, and then Paths and Symbols, then select Includestab, in Languageslist choose GNU C++(or whichever toolchain is your current). Now you can see Add...button to the very right, click it and provide a path to the directory which contains includes, for example: D:\Libraries\MiniXML\include. Don't forget to check the Add to all configurationscheckbox. That's it, we are done.

左键单击您的项目并选择Properties,然后转到以下部分:C/C++ General,然后Paths and Symbols,然后选择Includes选项卡,在Languages列表中选择GNU C++(或您当前使用的任何工具链)。现在您可以看到Add...最右侧的按钮,单击它并提供包含包含的目录的路径,例如:D:\Libraries\MiniXML\include. 不要忘记选中Add to all configurations复选框。就是这样,我们完成了。

回答by Yinon Ehrlich

As @Alexander-Shukaev pointed out, adding Include Path(-I) is done using PropertiesC/C++ GeneralPaths and SymbolsIncludes.

正如@Alexander-Shukaev指出的那样,添加包含路径(-I)是使用PropertiesC/C++ GeneralPaths and Symbols→ 完成的Includes

OTH, adding Include File(-include, AKA 'forced include') is done using PropertiesC/C++ GeneralPaths and SymbolsIncludes Files.

OTH,添加包含文件(-include,又名“强制包含”)是使用PropertiesC/C++ GeneralPaths and Symbols→ 完成的Includes Files

Note #1: as of Eclipse Oxygen, there is another way to do that - PropertiesC/C++ GeneralPreprocessor Include Paths, Macros etc.CDT User Settings EntriesAddInclude File(use the drop-down box). Not clear way one would want either.

注意 #1:从 Eclipse Oxygen 开始,还有另一种方法可以做到这一点 - PropertiesC/C++ GeneralPreprocessor Include Paths, Macros etc.CDT User Settings EntriesAddInclude File(使用下拉框)。也不清楚人们想要的方式。

Note #2: use of variables helps to set configuration specific settings. For example - ${ProjDirPath}/${ConfigName}/config.h

注意#2:变量的使用有助于设置特定于配置的设置。例如 -${ProjDirPath}/${ConfigName}/config.h