[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: g++

<shashi@fcrao1.astro.umass.edu> writes:

> I upgraded my machine to potato but in compiling a c++
> program which before used to work with
> g++ -lg++ filename.cc,
> now I need
> g++ -I/usr/include/g++-2/ -lg++ filename.cc

-lg++ links libg++, which are auxiliary, non-standard
convenience-classes that are no longer maintained.
What you want is libstdc++, and you don't need to specify this explicitly
when linking with g++ (as opposed to ld).
> two questions:
> 1) WHy do I need the -I now and

-I/usr/include/g++-2/ might simply include the libstdc++-headers ?
but these should really be included by default.
(are you using gcc 2.95.2 ?)

for example, on my system using libstdc++-v3 (the latest version under

felix@home:~ > ls <prefix>/include/g++-v3/
algorithm    cfloat   cstddef	 ext	     istream   ostream	  strstream
atomicity.h  ciso646  cstdio	 fstream     iterator  queue	  typeinfo
backward     climits  cstdlib	 fstream.h   limits    set	  utility
bits	     clocale  cstring	 functional  list      shadow	  valarray
bitset	     cmath    ctime	 iomanip     locale    sstream	  vector
bu	     complex  cwchar	 ios	     map       stack
cassert      csetjmp  cwctype	 iosfwd      memory    stdexcept
cctype	     csignal  deque	 iostream    new       streambuf
cerrno	     cstdarg  exception  iostream.h  numeric   string

(the ones for gcc 2.95.2 will look a little differently)
> 2) The second command doesnt work. It complains
> /usr/bin/ld: cannot find -lg++
> collect2: ld returned 1 exit status
> though all the libraraies are in /usr/lib. Any ideas?

Felix Natter

Reply to: