automake
[Top][All Lists]
Advanced

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

Re: Mixing C and C++


From: Ralf Wildenhues
Subject: Re: Mixing C and C++
Date: Wed, 7 Sep 2005 17:04:17 +0200
User-agent: Mutt/1.4.1i

Hi Sam,

* Adams Samuel D Contr AFRL/HEDR wrote on Wed, Sep 07, 2005 at 04:22:25PM CEST:
> I am writing a new program in C++ as it can use complex numbers and C does
> not have that functionality, but I am also trying to use a C library that I
> wrote before for another program that handles all of the data.  It seems
> that g++ has to compile the C code in order for it to be able to link the
> object files and not gcc.  But, automake tries to compile c code with gcc
> and c++ code with g++, but then linking breaks.  Is there some kind of
> directive that I need to put in the configure.ac to get this to work, or
> what am I not understanding?

No, in general it should not be necessary to compile the C code with a
C++ compiler in order to link both together.  A couple of things to
check: did you declare the C functions as `extern "C"' for C++?
Does the link line Automake creates use the C++ compiler (g++) to link?
If not, please post a representative part of Makefile.am to show how you
use it.  Also, do you use a recent Automake version?  Which one?
What kind of link errors do you see (post the first few of them)?

BTW, reading
  info Automake "Mixing Fortran 77 With C and C++"
and/or posting a reproducible example helps a lot.  :-)

Cheers,
Ralf




reply via email to

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