Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved <iostream> in Eclipse, Ubuntu

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

like image 833
David Kaczynski Avatar asked Sep 08 '12 23:09

David Kaczynski


1 Answers

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.

like image 76
Benjamin Avatar answered Nov 12 '22 13:11

Benjamin