This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
compiling programs with libstdc++
- To: gcc-help at gcc dot gnu dot org
- Subject: compiling programs with libstdc++
- From: "Jason M'Sadoques" <jsado at mediaone dot net>
- Date: Wed, 1 Aug 2001 18:39:26 -0400 (EDT)
I just compiled libstdc++ 2.90.8, to be used with gcc 2.95.2. I followed the directions for compiling just the library,
since I already had a working copy of gcc, except that I had to edit a Makefile to comment out the WERROR=-Werror line
because it was treating warnings as errors and would not finish compiling.
It compiled and installed fine, but however, when I try a test program:
//Test out libstdc++.
#include <iostream>
#include <ios>
int main()
{
cout << hex << showbase;
cout << int(12);
}
I get these errors in trying to link:
jlm /home/jlm/code2/temp 252>g++ -I/usr/include/g++-v3 dud.cpp
/tmp/ccWA5q6N.o: In function `main':
/tmp/ccWA5q6N.o(.text+0x1c): undefined reference to `basic_ostream<char, char_traits<char> >::operator<<(ios_base &(*)(ios_base &))'
/tmp/ccWA5q6N.o(.text+0x27): undefined reference to `basic_ostream<char, char_traits<char> >::operator<<(ios_base &(*)(ios_base &))'
/tmp/ccWA5q6N.o: In function `__static_initialization_and_destruction_0':
/tmp/ccWA5q6N.o(.text+0x66): undefined reference to `ios_base::Init::Init(void)'
/tmp/ccWA5q6N.o(.text+0x7b): undefined reference to `ios_base::Init::~Init(void)'
/tmp/ccWA5q6N.o: In function `basic_ostream<char, char_traits<char> >::operator<<(int)':
/tmp/ccWA5q6N.o(.gnu.linkonce.t.__ls__t13basic_ostream2ZcZt11char_traits1Zci+0x67): undefined reference to `basic_ostream<char, char_traits<char> >::operator<<(unsigned long)'
/tmp/ccWA5q6N.o(.gnu.linkonce.t.__ls__t13basic_ostream2ZcZt11char_traits1Zci+0x7c): undefined reference to `basic_ostream<char, char_traits<char> >::operator<<(long)'
collect2: ld returned 1 exit status
but I get this error if I specify the library path:
jlm /home/jlm/code2/temp 251>g++ -I/usr/include/g++-v3 -L/usr/lib dud.cpp
/usr/lib/libstdc++.so: undefined reference to `__ne__H3ZPPQ26locale5facetZPPQ26locale5facetZt6vector2ZPQ26locale5facetZt9allocator1ZPQ26locale5facet_RCt17__normal_iterator2ZX01ZX21RCt17__normal_iterator2ZX11ZX21_b'
collect2: ld returned 1 exit status
Now this is odd, because it should already know the library path. I'm not sure how this happened, and any help in getting
things to compile would be appreciated. I am running Linux 2.2.17 on an i386 machine.
Thanks
--
MACINTOSH = Machine Always Crashes If Not The Operating System Hangs
"Life would be so much easier if we could just look at the source code." - Dave Olson