help-gplusplus
[Top][All Lists]
Advanced

[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: Paul Pluzhnikov
Subject: Re: library problem - my own version of C++ using gcc does not link
Date: Thu, 24 May 2007 11:06:09 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

Jim Anderson <ezjab@ieee.org> writes:

> The link line is:
>  >>   gcc -g -o test test.o Product.o DerivedProduct.o Creator.o
>  DerivedCreator.o

Well, that explains it.

> I used gcc because when I downloaded g++, the tarball did not
> appear to have a complete set of code to build g++.

There is no 'g++ tarball' (please be *precise* in what you say).
Possibly you downloaded gcc-g++-4.1.2.tar.bz2, which also requires
gcc-core-4.1.2.tar.bz2

OTOH, your original message said you downloaded gcc-4.1.2.tar.bz2,
which has everything.

> At one time, didn't gcc compile and link C++ code?

It can, but you shouldn't do that.

> I do think it
> is strange that gcc will compile C++ code, but not link it.

Nothing strange: when 'gcc' sees that it is compiling foo.cpp,
it says: "oh, stupid user doesn't know how to use proper compiler
driver, I'll just fix it up for him" and switches to C++ mode.

But when it sees that you are linking foo.o, it can't do the same
thing easily (it would need to "peek" into foo.o, discover that
there are unresolved C++-mangled names, and then switch to C++
mode. Doing that is beyond reasonable effort, and would slow every
correct C-only link; so gcc doesn't do that).

> If I can figure out how to build g++

On Linux, you just do 
   ./configure --enable-languages=c,c++; make; make install

Couldn't be easier.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]