Re: Linking in C++ mode

2002-11-14 Thread Alexandre Duret-Lutz
>>> "Ralf" == Ralf Corsepius <[EMAIL PROTECTED]> writes: [...] Ralf> 2. Finding a way to convince automake to using "g++" to link a you Ralf> program. Ralf> Automake guesses upon the linker by using file name extensions. Your Ralf> "main" is called "*.c", so it tries to use "gcc" instead of

Re: Linking in C++ mode

2002-11-14 Thread John Levon
On Thu, Nov 14, 2002 at 12:40:29PM +0100, Alexandre Duret-Lutz wrote: > You can override the LINK command on a per-program basis: > > foo_LINK = $(CXX) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ Works a treat. Thanks a lot. regards john -- Khendon's Law: If the same point is made t

Re: Linking in C++ mode

2002-11-11 Thread Ralf Corsepius
Am Son, 2002-11-10 um 12.01 schrieb Earnie Boyd: > John Levon wrote: > > We have a C program which links to a C++ library, and we need to > > tell automake to do the link in C++ mode to avoid undefined references > > to the C++ standard library. How can we do it ? > > > > The Makefile.am looks as

Re: Linking in C++ mode

2002-11-10 Thread John Levon
On Mon, Nov 11, 2002 at 05:36:57AM +0100, Ralf Corsepius wrote: > 1. Finding a way to compile your program (independently of automake). > > You are using a library written in c++, therefore a general solution is > using "g++" to _link_ your program, even if your "main" is written in C. > > Rule

Re: Linking in C++ mode

2002-11-10 Thread Ralf Corsepius
Am Mon, 2002-11-11 um 00.50 schrieb Earnie Boyd: > John Levon wrote: > > 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. > > > > Why? Because linking c++ is more

Re: Linking in C++ mode

2002-11-10 Thread Ralf Corsepius
Am Son, 2002-11-10 um 16.31 schrieb John Levon: > 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

Re: Linking in C++ mode

2002-11-10 Thread Pierre Sarrazin
Dixit John Levon (2002-11-11 04:09): > > clean-local: > > rm -f dummy.cc > > I did > > CLEANFILES = dummy.cc > > instead, which seems "better" Oops, too much vodka. It's certainly better, even without the quotes. -- Pierre Sarrazin

Re: Linking in C++ mode

2002-11-10 Thread John Levon
On Sun, Nov 10, 2002 at 10:39:59PM -0500, Pierre Sarrazin wrote: > By the way, to avoid having the 'dist' target include dummy.cc in > the distributed source tarball, one has to say this: whoops, forgot about this. thanks. > And to have 'clean' erase the generated dummy.cc: > > clean-local: >

Re: Linking in C++ mode

2002-11-10 Thread Pierre Sarrazin
Dixit John Levon (2002-11-11 00:36): > On Sun, Nov 10, 2002 at 05:42:30PM -0500, Pierre Sarrazin wrote: > > Another way to force automake to use g++ to link the application > > seems to be to leave the .c alone, but to add a dummy.cc file to > > the application's _SOURCES variable. The .c file is

Re: Linking in C++ mode

2002-11-10 Thread John Levon
On Sun, Nov 10, 2002 at 05:42:30PM -0500, Pierre Sarrazin wrote: > Another way to force automake to use g++ to link the application > seems to be to leave the .c alone, but to add a dummy.cc file to > the application's _SOURCES variable. The .c file is still compiled > by gcc. This seems like th

Re: Linking in C++ mode

2002-11-10 Thread John Levon
On Sun, Nov 10, 2002 at 06:50:47PM -0500, Earnie Boyd wrote: > >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. > > It's the hack that using g++ performs. I do not believe there is any gua

Re: Linking in C++ mode

2002-11-10 Thread Earnie Boyd
John Levon wrote: 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. Why? I do not think getting gcc to link -lstdc++ is a good idea either, but it doesn't have much more hack v

Re: Linking in C++ mode

2002-11-10 Thread Pierre Sarrazin
Dixit John Levon (2002-11-10 15:31): > > 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

Re: Linking in C++ mode

2002-11-10 Thread John Levon
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 p

Re: Linking in C++ mode

2002-11-10 Thread Earnie Boyd
John Levon wrote: We have a C program which links to a C++ library, and we need to tell automake to do the link in C++ mode to avoid undefined references to the C++ standard library. How can we do it ? The Makefile.am looks as follows : ---snip--- dist_sources = oprofiled.c opd_stats.c opd_kern

Linking in C++ mode

2002-11-09 Thread John Levon
We have a C program which links to a C++ library, and we need to tell automake to do the link in C++ mode to avoid undefined references to the C++ standard library. How can we do it ? The Makefile.am looks as follows : ---snip--- dist_sources = oprofiled.c opd_stats.c opd_kernel.c opd_image.c o