17

Yes, it's this question again...

Somehow, I cannot get this issue resolved. Believe it or not, I have experience with Eclipse but only for Java development. I have programmed in C++ using vi but not with Eclipse.

I have installed:

  • Ubuntu 12.04
  • Eclipse 3.7.2
  • GCC 4.6.3
  • Eclipse CDT 8.0.2

I created an empty Makefile project and selected the Linux GNU Toolchain:

empty Makefile project

I get the standard Unresolved inclusion <iostream> error, and I have some references to various "include" directories in the project:

<code>Unresolved inclusion <iostream></code> error

I did notice that, while my "Paths and Symbols" setting for GNU C contains various paths, the same setting for GNU C++ is empty:

GNU C Paths and Symbols

GNU C++ Paths and Symbols

Also, I have the "GNU Elf Parser" under my C/C++ build settings:

enter image description here


What am I doing wrong here?

Cheers


Edit:

Here's an updated photo of my a project's build path that is working correctly: Updated build path

David Kaczynski
  • 1,246
  • 2
  • 20
  • 36

2 Answers2

6

The reason is that Eclipse simply cannot import a proper header. C++ iostream header in Ubuntu can be found:

$: sudo find / -name iostream

/home/beniamin/QtSDK/Madde/toolchains/arm-2009q3-67-arm-none-linux-gnueabi-x86_64-unknown-linux-gnu/arm-2009q3-67/arm-none-linux-gnueabi/include/c++/4.4.1/iostream
/home/beniamin/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/usr/include/c++/4.4/iostream
/usr/share/gccxml-0.9/GCC/2.95/iostream
/usr/include/c++/4.6/iostream
/usr/include/boost/tr1/tr1/iostream

So basically, I suppose the one you are looking for is /usr/include/c++/4.6/iostream, so you should in some place include this directory.

Edit: You should also have installed g++, or simply install build-essential package, which is obligatory for building debian packages. Nevertheless, g++ should have been included in your Ubuntu installation anyway.

kiri
  • 2,522
  • 4
  • 26
  • 44
Benjamin
  • 3,217
  • 2
  • 27
  • 42
  • 2
    Yep! I was lacking the build-essential installation. Odd that the default installation of Ubuntu 12.04 did not include this, but regardless, `sudo apt-get install build-essential` fixed this. Thanks! – David Kaczynski Sep 09 '12 at 00:29
  • It got fixed after I included the iostream path in the include directories. However, though it now builds the project correctly, it still shows a question mark symbol next to the includes "Unresolved inclusion". Why is it still there? Any possible explanation ? – Coder Sep 20 '14 at 20:35
0

Yes, I have found that using

$: sudo find / -name iostream

and adding the includes file in the includes path and then it success.

iberbeu
  • 15,295
  • 5
  • 27
  • 48
Snow
  • 29
  • 3