具有CDT的Eclipse Juno不添加内置的目录 [英] Eclipse Juno with CDT Doesn't Add Built-in Include Directories
问题描述
自从我从Eclipse Indigo升级到Juno(在Ubuntu 12.04上)以来,我遇到了一个问题,它显示了标准库的未解决的包含错误(例如在 #include< iostream> ;
和 #include< vector>
等),尽管程序构建并运行正常(使用g ++)。这只会发生在用Juno创建的新项目中,而不是在我的工作空间中从靛蓝创建的新项目。
Since I upgraded from Eclipse Indigo to Juno (on Ubuntu 12.04), I've been having the problem where it shows "unresolved inclusion" errors for standard libraries (e.g. next to #include <iostream>
and #include <vector>
, etc.), although the program builds and runs fine (using g++). This only occurs in new projects created with Juno, not old ones from Indigo in my workspace.
感谢其他几个问题(见下文*),我能够跟踪项目的属性> C / C ++常规>路径和符号>包含选项卡中的内置值的问题的来源:
Thanks to several other SO questions (see below*), I was able to trace the source of the problem to the absence of the "built-in values" in a project's Properties > C/C++ General > Paths and Symbols > Includes tab:
/usr/include/c++/4.6
/usr/include/c++/4.6/x86_64-linux-gnu
/usr/include/c++/4.6/backward
/usr/lib/gcc/x86_64-linux-gnu/4.6/include
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
当显示内置值复选框勾选在我没有这个问题的老靛蓝项目中,但在我用Juno创建的新项目中缺少。果然,如果我将这七个目录手动添加到项目设置中的包含选项卡中,则问题消失。但是我不想为每个我创建的新项目手动执行此操作。有没有理由这不再是Juno的默认,有没有办法恢复它?
are present when the "Show built-in values" checkbox is ticked in my old Indigo projects that didn't have this problem, but are absent in my new projects created with Juno. Sure enough, if I add these seven directories manually to the Includes tab in a project's settings, the problem disappears. But I don't want to have to do this manually for every new project I create. Is there a reason this is no longer the default in Juno, and is there a way to restore it?
*其他涉及类似问题的其他SO问题我已经咨询但没有解决我的问题:
*Other SO questions with similar issues I have consulted but did not solve my problem:
- Eclipse 3.7.0靛蓝与CDT显示许多错误的编译错误:我认为ErzsébetGeréb的答案将是我的解决方案 - 在Juno,如果我创建一个新的C ++项目与项目类型作为GNU Autotools之一类别的可执行,内置的目录在那里。 (在Indigo中,没有GNU Autotools类别,如果我在Indigo中创建了一个可执行文件中的空或Hello World项目,那么这些目录就在那里,但是如果我在Juno中这样做,我不会在GNU Autotools下选择一个选项)然后,使用GNU Autotools项目,当我进入项目的属性> C / C ++构建>设置时,工具设置选项卡不再存在,我无法为GCC C ++编译器和GCC C ++链接器的库添加包含路径,我需要做,因为我的许多C ++项目使用OpenCV库。
- 未解决的包含使用Eclipse CDT for C标准库标题的错误:告诉我如何手动添加包含路径,但不知道如何在默认情况下添加内置的
- 错误,矢量无法解析:清理
〜/ .eclipse /
和重建索引没有帮助。 - Eclipse CDT内置包含目录:发现选项设置与我的项目正常工作相同。
- eclipse CDT 8.01 - 完全默认路径(libstdc,libstdc ++)消失在'includes'目录
- Eclipse CDT索引器丢失了更新系统更新:不解决所有新项目的问题。
- Eclipse 3.7.0 Indigo with CDT shows many false compilation errors: I thought Erzsébet Geréb's answer would be my solution -- in Juno, if I create a new C++ project with "Project type" as one of the categories under "GNU Autotools" instead of "Executable," the built-in directories are there. (In Indigo, there's no GNU Autotools category. If I created it in Indigo as an empty or Hello World project under "Executable," those directories are there, but they're not if I do it that way in Juno -- I have to pick an option under "GNU Autotools.") But then, with a "GNU Autotools" project, when I go to the project's Properties > C/C++ Build > Settings, the "Tool Settings" tab is no longer present and I am unable to add include paths for the GCC C++ Compiler and libraries for the GCC C++ Linker, which I need to do because many of my C++ projects use OpenCV libraries.
- "Unresolved inclusion" error with Eclipse CDT for C standard library headers: Told me how to add the include paths manually, but not how to have the built-in ones added by default
- error , Symbol 'vector' could not be resolved: Cleaning
~/.eclipse/
and rebuilding index didn't help. - Eclipse CDT Builtin Include Directories: Discovery Options are set the same as my projects that do work properly.
- eclipse CDT 8.01 - default paths (libstdc,libstdc++) totally disappeared in 'includes' directory
- Eclipse CDT indexer lost after system update: Doesn't solve the problem for all new projects.
推荐答案
p>请
- 打开Eclipse首选项对话框( Windows |首选项)。
- 打开 C ++ |构建|
- 打开发现标签。
- 选择内置的编译器设置条目。 / li>
- 按清除条目按钮。
- Open the Eclipse Preferences dialog (Windows | Preferences).
- Open C++ | Build | Settings.
- Open the Discovery tab.
- Select the built-in compiler settings entry.
- Press the Clear Entries button.
之后,eclipse应该从编译器再次请求默认值。
Afterwards eclipse should request the defaults again from the compiler.
Arch Linux我必须在每个GCC版本更改后执行此操作,因为在这种情况下,默认值的位置随着版本在文件夹名称中的编码而改变,eclipse不会注意到这一点。
On Arch Linux I had to do this after each GCC version change, because in that case the locations for the defaults changed as the version is encoded in the folder name, and eclipse does not notice this.
这篇关于具有CDT的Eclipse Juno不添加内置的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!