public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with C++ on gcc 3
@ 2002-07-04  2:18 Paul Butcher
  2002-07-04  3:39 ` Andrea 'Fyre Wyzard' Bocci
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Butcher @ 2002-07-04  2:18 UTC (permalink / raw)
  To: gcc-help

I have a rather basic problem with compiling a simple C++ program, or rather 
with the final linking using collect2.  This is the call made:
/opt/experimental/bin/gcc -v -O2 -o CPPTest ../CPPTest.cpp ../CPPTestMain.cpp

The following is the verbose output for the final collect2 stage:
 /opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/collect2 -m elf_i386 
-dynamic-linker /lib/ld-linux.so.2 -o CPPTest /usr/lib/crt1.o /usr/lib/crti.o 
/opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/crtbegin.o 
-L/opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1 
-L/opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/../../.. 
/tmp/cc3xAK5D.o /tmp/ccq0irtE.o -lgcc -lc -lgcc 
/opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/crtend.o /usr/lib/crtn.o
/tmp/ccq0irtE.o: In function `__FRAME_BEGIN__':
/tmp/ccq0irtE.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

As you see this is with SuSE7.3 LInux gcc 3.0.1 'experimental' build - but I 
get the same problem with a cygwin compiled gcc 3.1 on Win9X. 
The problem occurs with the most minimal C++ class so I presume it's 
something fundamental I'm doing wrong!

(It always worked with gcc 2.95.x)

Paul Butcher
ALTON, Hants, UK

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

* Re: Problem with C++ on gcc 3
  2002-07-04  2:18 Problem with C++ on gcc 3 Paul Butcher
@ 2002-07-04  3:39 ` Andrea 'Fyre Wyzard' Bocci
  2002-07-08  1:54   ` Paul Butcher
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2002-07-04  3:39 UTC (permalink / raw)
  To: Paul Butcher, gcc-help

Use g++ to link/compile C++ code, not gcc.

HTH, fwyzard


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

* Re: Problem with C++ on gcc 3
  2002-07-04  3:39 ` Andrea 'Fyre Wyzard' Bocci
@ 2002-07-08  1:54   ` Paul Butcher
  2002-07-08  8:03     ` Andrea 'Fyre Wyzard' Bocci
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Butcher @ 2002-07-08  1:54 UTC (permalink / raw)
  To: Andrea 'Fyre Wyzard' Bocci, gcc-help

Thanks for the obvious answer - my problem was two-fold:
1.  using gcc instead of g++ as you stated: -lstdc++ is not included in the 
linker stage.
Why does gcc 3.1 not allow this?  gcc 2.95.x included the correct libraries 
when calling gcc.

2.  I also had gcc 2.95.3 installed in a different path and libstdc++ was 
being found there before the new 3.1 library.
Why does the library path used by gcc not start with its installation 
libraries rather than generic paths like /usr/lib?

Paul Butcher
ALTON, Hants, UK


On Thursday 04 Jul 2002 11:39, Andrea 'Fyre Wyzard' Bocci wrote:
>
> Use g++ to link/compile C++ code, not gcc.
>
> HTH, fwyzard

---- Original Message ----

> I have a rather basic problem with compiling a simple C++ program, or
> rather with the final linking using collect2.  This is the call made:
> /opt/experimental/bin/gcc -v -O2 -o CPPTest ../CPPTest.cpp
> ../CPPTestMain.cpp
>
> The following is the verbose output for the final collect2 stage:
>  /opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/collect2 -m elf_i386
> -dynamic-linker /lib/ld-linux.so.2 -o CPPTest /usr/lib/crt1.o
> /usr/lib/crti.o
> /opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/crtbegin.o
> -L/opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1
> -L/opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/../../..
> /tmp/cc3xAK5D.o /tmp/ccq0irtE.o -lgcc -lc -lgcc
> /opt/experimental/lib/gcc-lib/i486-suse-linux/3.0.1/crtend.o
> /usr/lib/crtn.o /tmp/ccq0irtE.o: In function `__FRAME_BEGIN__':
> /tmp/ccq0irtE.o(.eh_frame+0x12): undefined reference to
> `__gxx_personality_v0' collect2: ld returned 1 exit status
>
> As you see this is with SuSE7.3 LInux gcc 3.0.1 'experimental' build - but
> I get the same problem with a cygwin compiled gcc 3.1 on Win9X.
> The problem occurs with the most minimal C++ class so I presume it's
> something fundamental I'm doing wrong!
>
> (It always worked with gcc 2.95.x)



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

* Re: Problem with C++ on gcc 3
  2002-07-08  1:54   ` Paul Butcher
@ 2002-07-08  8:03     ` Andrea 'Fyre Wyzard' Bocci
  2002-07-09  1:09       ` Paul Butcher
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2002-07-08  8:03 UTC (permalink / raw)
  To: Paul Butcher, gcc-help

At 09:50 08/07/2002 +0100, Paul Butcher wrote:
>Thanks for the obvious answer - my problem was two-fold:
>1.  using gcc instead of g++ as you stated: -lstdc++ is not included in the
>linker stage.
>Why does gcc 3.1 not allow this?  gcc 2.95.x included the correct libraries
>when calling gcc.

Didn't know it did that :-)


>2.  I also had gcc 2.95.3 installed in a different path and libstdc++ was
>being found there before the new 3.1 library.
>Why does the library path used by gcc not start with its installation
>libraries rather than generic paths like /usr/lib?

It depends on how you installed GCC:
if you installed a precompiled binary from a package, the fault is of the 
packager;
if you bootstrapped from source, the fault is probably GCC's installation 
procedure's.

fwyzard


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

* Re: Problem with C++ on gcc 3
  2002-07-08  8:03     ` Andrea 'Fyre Wyzard' Bocci
@ 2002-07-09  1:09       ` Paul Butcher
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Butcher @ 2002-07-09  1:09 UTC (permalink / raw)
  To: Andrea 'Fyre Wyzard' Bocci, gcc-help

For clarity I built gcc 3.1 from source for Win32/cygwin but have confirmed 
the behaviour against gcc 3.0.4 built for LInux for SuSE8.0.  

Paul Butcher
Alton, Hants, UK

On Monday 08 Jul 2002 16:03, Andrea 'Fyre Wyzard' Bocci wrote:
>
> At 09:50 08/07/2002 +0100, Paul Butcher wrote:
> >Thanks for the obvious answer - my problem was two-fold:
> >1.  using gcc instead of g++ as you stated: -lstdc++ is not included in
> > the linker stage.
> >Why does gcc 3.1 not allow this?  gcc 2.95.x included the correct
> > libraries when calling gcc.
>
> Didn't know it did that :-)
>
> >2.  I also had gcc 2.95.3 installed in a different path and libstdc++ was
> >being found there before the new 3.1 library.
> >Why does the library path used by gcc not start with its installation
> >libraries rather than generic paths like /usr/lib?
>
> It depends on how you installed GCC:
> if you installed a precompiled binary from a package, the fault is of the
> packager;
> if you bootstrapped from source, the fault is probably GCC's installation
> procedure's.
>
> fwyzard

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

end of thread, other threads:[~2002-07-09  8:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-04  2:18 Problem with C++ on gcc 3 Paul Butcher
2002-07-04  3:39 ` Andrea 'Fyre Wyzard' Bocci
2002-07-08  1:54   ` Paul Butcher
2002-07-08  8:03     ` Andrea 'Fyre Wyzard' Bocci
2002-07-09  1:09       ` Paul Butcher

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).