[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: library problem - my own version of C++ using gcc does not link
From: |
Robert Heller |
Subject: |
Re: library problem - my own version of C++ using gcc does not link |
Date: |
Thu, 24 May 2007 23:19:00 +0200 |
At Thu, 24 May 2007 11:09:10 -0700 Paul Pluzhnikov
<ppluzhnikov-nsp@charter.net> wrote:
>
> Robert Heller <heller@deepsoft.com> writes:
>
> > gcc can link C++ code, but you need to give it a 'hint' that you are in
> > fact linking C++ code, usually by including the -l option(s) that g++
> > would normally add:
> >
> > gcc -g -o test test.o Product.o DerivedProduct.o Creator.o \
> > DerivedCreator.o -lstdc++ -lc++
>
> This (IMHO) is a very bad advice(TM).
Very true. My point is that g++ adds some additional options to the
link step that are specific to C++ -- one should *always* use g++ to
link C++ code (compiled by g++).
>
> The link line above is incorrect for all versions of gcc I am
> aware of.
Yeah, probably it is. It is NOT something I have done in recent times.
>
> Correct link line may (and does) change with different versions of
> g++, so *never* do this. Always use 'g++' to link C++ code.
>
> Cheers,
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk