/tmp/cc0IGuxk.o(.text+0x14): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char>
>& std::endl<char, std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&)'
/tmp/cc0IGuxk.o(.text+0x21): In function `main':
: undefined reference to `std::cout'
/tmp/cc0IGuxk.o(.text+0x26): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char>
>& std::operator<< <std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
... and so on.
I suspect this is just a path problem?
Also, I had to compile it with -I because otherwise it would not find a
lot of h files:
gcc -I/usr/include/g++/i586-suse-linux /tmp/helloworld.cpp
How can I add /usr/include/g++/i586-suse-linux
to the standard paths to look for h files?
The reason for all this mess is that I had replaced some gcc3.3.23 rpms
with gcc3.3.43 rpms, but probably I forgot to update some of them, and so
I got the chaos. Now I copied all 3.3.23 files back, and have these path
issues described above.
Does anyone know how to solve this?
Thanks, Andi
> I have a simple hello world program, but it does not compile:
Oh yes it does. What it doesn't do is link (linking and compilation
are separate steps).
> I suspect this is just a path problem?
It isn't. It's a problem of using incorrect compiler front end.
You are obviously compiling C++, you should use g++ for it.
> Also, I had to compile it with -I because otherwise it would not find
> a lot of h files:
Same solution: use 'g++' instead of 'gcc'.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
> Andreas Schmidt <schmid...@gmx.de> writes:
>
>> I have a simple hello world program, but it does not compile:
>
> Oh yes it does. What it doesn't do is link (linking and compilation
> are separate steps).
>
>> I suspect this is just a path problem?
>
> It isn't. It's a problem of using incorrect compiler front end.
> You are obviously compiling C++, you should use g++ for it.
>
>> Also, I had to compile it with -I because otherwise it would not find
>> a lot of h files:
>
> Same solution: use 'g++' instead of 'gcc'.
>
> Cheers,
Oh, I thought they are equvalent, I'm sorry. Anyway, I tried both, and
g++ always gives me this:
/usr/lib/gcc-lib/i586-suse-linux/3.3/../../../libstdc++.a(eh_throw.o)(.text.__cxa_rethrow+0x48):
In function `__cxa_rethrow':
: undefined reference to `_Unwind_Resume_or_Rethrow'
(see earlier posting from Nov 27)
But I don't care anymore, I am anyway updating my complete OS now... :)
> > Same solution: use 'g++' instead of 'gcc'.
>
> Oh, I thought they are equvalent
That is a common misconception.
The differences are quite significant, both at compile and at link time.