public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* compiling programs with libstdc++
@ 2001-08-01 15:39 Jason M'Sadoques
  2001-08-01 19:25 ` aoliva
  0 siblings, 1 reply; 4+ messages in thread
From: Jason M'Sadoques @ 2001-08-01 15:39 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: compiling programs with libstdc++
  2001-08-01 15:39 compiling programs with libstdc++ Jason M'Sadoques
@ 2001-08-01 19:25 ` aoliva
  2001-08-02 13:07   ` Re[2]: " Jason M'Sadoques
  0 siblings, 1 reply; 4+ messages in thread
From: aoliva @ 2001-08-01 19:25 UTC (permalink / raw)
  To: Jason M'Sadoques; +Cc: gcc-help

On Aug  1, 2001, "Jason M'Sadoques" <jsado@mediaone.net> wrote:

> jlm /home/jlm/code2/temp 252>g++ -I/usr/include/g++-v3 dud.cpp

Did you try -fhonor-std ?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re[2]: compiling programs with libstdc++
  2001-08-01 19:25 ` aoliva
@ 2001-08-02 13:07   ` Jason M'Sadoques
  2001-08-02 13:59     ` Alexandre Oliva
  0 siblings, 1 reply; 4+ messages in thread
From: Jason M'Sadoques @ 2001-08-02 13:07 UTC (permalink / raw)
  To: gcc-help

On 01 Aug 2001 23:25:26 -0300 aoliva@redhat.com wrote:

> On Aug  1, 2001, "Jason M'Sadoques" <jsado@mediaone.net> wrote:
> 
> > jlm /home/jlm/code2/temp 252>g++ -I/usr/include/g++-v3 dud.cpp
> 
> Did you try -fhonor-std ?
Thanks for the quick response. I added using namespace std;
and then recompiled with -fhonor-std and got the same linking errors:

jlm /home/jlm/code2/temp 261>g++ -fhonor-std -I/usr/include/g++-v3 dud.cpp
/tmp/ccx5BRT3.o: In function `main':
/tmp/ccx5BRT3.o(.text+0x17): undefined reference to `std::cout'
/tmp/ccx5BRT3.o(.text+0x1c): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::ios_base &(*)(std::ios_base &))'
/tmp/ccx5BRT3.o(.text+0x27): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::ios_base &(*)(std::ios_base &))'
/tmp/ccx5BRT3.o(.text+0x34): undefined reference to `std::cout'
/tmp/ccx5BRT3.o: In function `__static_initialization_and_destruction_0':
/tmp/ccx5BRT3.o(.text+0x66): undefined reference to `std::ios_base::Init::Init(void)'
/tmp/ccx5BRT3.o(.text+0x7b): undefined reference to `std::ios_base::Init::~Init(void)'
/tmp/ccx5BRT3.o: In function `std::ios_base::failure type_info function':
/tmp/ccx5BRT3.o(.gnu.linkonce.t.__tfQ33std8ios_base7failure+0x10): undefined reference to `std::exception type_info function'
/tmp/ccx5BRT3.o(.gnu.linkonce.t.__tfQ33std8ios_base7failure+0x1a): undefined reference to `std::exception type_info node'
/tmp/ccx5BRT3.o: In function `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)':
/tmp/ccx5BRT3.o(.gnu.linkonce.t.__ls__Q23stdt13basic_ostream2ZcZQ23stdt11char_traits1Zci+0x67): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(unsigned long)'
/tmp/ccx5BRT3.o(.gnu.linkonce.t.__ls__Q23stdt13basic_ostream2ZcZQ23stdt11char_traits1Zci+0x7c): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(long)'
collect2: ld returned 1 exit status

For reference again, here is my program:

//Test out libstdc++.

#include <iostream>
#include <ios>

using namespace std;
int main()
{
  cout << hex << showbase;
  cout << int(12);
}
--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re[2]: compiling programs with libstdc++
  2001-08-02 13:07   ` Re[2]: " Jason M'Sadoques
@ 2001-08-02 13:59     ` Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2001-08-02 13:59 UTC (permalink / raw)
  To: Jason M'Sadoques; +Cc: gcc-help

On Aug  2, 2001, "Jason M'Sadoques" <jsado@mediaone.net> wrote:

> jlm /home/jlm/code2/temp 261>g++ -fhonor-std -I/usr/include/g++-v3 dud.cpp
> /tmp/ccx5BRT3.o: In function `main':
> /tmp/ccx5BRT3.o(.text+0x17): undefined reference to `std::cout'

It doesn't seem like you have build libstdc++-v3 with -fhonor-std, as
in the recommended installation procedure (IIRC).

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-08-02 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-01 15:39 compiling programs with libstdc++ Jason M'Sadoques
2001-08-01 19:25 ` aoliva
2001-08-02 13:07   ` Re[2]: " Jason M'Sadoques
2001-08-02 13:59     ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).