Eclipse Juno与CDT不添加内置包括目录 [英] Eclipse Juno with CDT Doesn't Add Built-in Include Directories

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

问题描述

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

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