automake
[Top][All Lists]
Advanced

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

Re: Linking in C++ mode


From: John Levon
Subject: Re: Linking in C++ mode
Date: Sun, 10 Nov 2002 15:31:16 +0000
User-agent: Mutt/1.3.25i

On Sun, Nov 10, 2002 at 01:01:08PM +0100, Ralf Corsepius wrote:

> > You could always just add -lstdc++ to the oprofiled_LDADD variable.
> This would be a fault, IMO.

I do not think getting gcc to link -lstdc++ is a good idea either, but
it doesn't have much more hack value than the solution you propose below
IMHO.

> The problem is trying to link a c-program against a c++-library. This
> doesn't work in general, esp. not with g++, unless such a c++ library is
> specially designed for such purposes.

Hmm, care to expand ? The library has an extern "C" interface used by the
C program, and an internal implementation coded in C++.

> Unresolved references to libstdc++
> indicate that your library has not been prepared for this.

Are you seriously saying I have to statically link the library ? Why ?
(for reference the library is a convenience library only, and noinst)

[if it matters, the application is necessarily linux-only]

> A proper solution would be to use g++ to link the application. To
> achieve this with automake, the easiest way is to convert the
> main-application file to c++. In your case, renaming oprofiled.c to
> oprofiled.cc would be sufficient.

This seems IMHO to be a terrible hack. I've found automake to be quite
flexible so far; am I hitting one of its limitations ?

thanks
john

-- 
"When a man has nothing to say, the worst thing he can do is to say it
memorably."
        - Calvin Trillin




reply via email to

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