Eclipse Juno与CDT不添加内置包括目录 [英] Eclipse Juno with CDT Doesn't Add Built-in Include Directories
问题描述
因为我从Eclipse Indigo升级到Juno(在Ubuntu 12.04上),我一直遇到这样的问题:它显示标准库的未解决的包含错误(例如 #include< iostream> ;
和 #include< vector>
等),尽管程序构建和运行良好(使用g ++)。这只会发生在使用Juno创建的新项目中,而不是我工作空间中来自Indigo的旧项目。
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.
由于其他一些SO问题在项目的属性> 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
<值复选框在我的旧Indigo项目中没有这个问题,但在我的新项目中没有创建与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?
*其他有类似问题的问题我已经咨询,但没有解决我的问题:
*Other SO questions with similar issues I have consulted but did not solve my problem:
- Eclipse 3.7.0 Indigo with 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库。
- 未解决的包含:< stdio.h> :告诉我如何手动添加包含路径,但不会默认添加内置路径。
- :清除
〜/ .eclipse / / code>和重建索引没有帮助。
- 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: <stdio.h>": 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.
推荐答案
- 打开Eclipse首选项对话框)。
- 打开 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.
这篇关于Eclipse Juno与CDT不添加内置包括目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!