g++ include problems

Craig Howard craig.howard at shadnet.shad.ca
Mon Oct 22 11:19:48 PDT 2001


Craig Howard wrote:

> I'm using gcc-2.95.3 and have recently done something to screw up my 
> header files.
> 
> #include <iostream>
> 
> int main()
> {
>     cout << "Hello World!" << endl;
>     return 0;
> }
> 
> when compiled with
> $ g++ -o world world.cpp
> 
> produces
> world.cc:1: iostream: No such file or directory


I reinstalled gcc again, and this problem seems to have disappeared.  I 
don't like these "magic" solutions, but hey, it works.

I think that I needed to specify 
--with-gxx-include-dir=/usr/include/g++, although I coulda sworn I did 
that.


> My header files are in /usr/include/g++  I've tried creating symlinks of 
> /usr/include/g++-3 /usr/include/g++-include and reinstalling gcc, none 
> of which have fixed the problem.  Note C programs compile fine, I was 
> able recompile the kernel with no problems.
> 
> when compiled with
> $ g++ -I/usr/include/g++ -o world world.cpp
> 
> produces:
> /tmp/cc79sAta.o: In function `main':
> /tmp/cc79sAta.o(.text+0xa): undefined reference to `endl(ostream &)'
> /tmp/cc79sAta.o(.text+0x17): undefined reference to `cout'
> /tmp/cc79sAta.o(.text+0x1c): undefined reference to 
> `ostream::operator<<(char const *)'
> /tmp/cc79sAta.o(.text+0x27): undefined reference to 
> `ostream::operator<<(ostream &(*)(ostream &))'
> collect2: ld returned 1 exit status


This problem is still here.  Is this a library problem, or a header 
problem.  It seems like library to me, but which library.  Sigh.

Again,
> Any help would be _much_ appreciated.


Craig Howard
craig.howard at shadnet.shad.ca

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message



More information about the lfs-support mailing list