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: Jim Anderson
Subject: Re: library problem - my own version of C++ using gcc does not link
Date: Fri, 25 May 2007 14:36:14 GMT
User-agent: Thunderbird 1.5.0.8 (X11/20061117)

Paul Pluzhnikov wrote:
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,


To all of the responders, thank you very much. I learned a lot
already and virtually all of my questions
have been answered.

> 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

I'm sorry for the loose terminology. Yes, it was gcc-g++-4.1.2.tar.bz2.
I'll download gcc-core.4.1.2.tar.bz2 later and see if I can get gcc
built.

You ALL explained well why gcc does not link and now I understand
from a technical viewpoint when g++ is need.

Cheers to ALL!

Jim

P.S. This kills this thread. I have other issues that I will
take to other threads.


reply via email to

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