具有CDT的Eclipse Juno不添加内置的目录 [英] Eclipse Juno with CDT Doesn't Add Built-in Include Directories

查看:142
本文介绍了具有CDT的Eclipse Juno不添加内置的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我从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 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆