This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Linking C and C++ together
- From: "Daniel Kraft" <d at daniel-kraft dot net>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 21 Apr 2005 18:46:16 +0200
- Subject: Linking C and C++ together
Dear GCC-team,
I want to use both C and C++ in a program (unfortunatly, the C source isn't
compatible with C++), and therefore I must compile the C files with "-x c"
(otherwise I get lots of errors, due to old-style function definitions).
This works just fine, but when I try to link both objects together, C++ doesn't
find the C functions and the other way round! (undefined reference)
May this be because I use an older cygwin-version of GCC (3.3.3)? Is there any
work-around (e. g., allowing C code to be compiled into C++ compatible objects)?
I looked through the manual, but I wasn't able to find a solution...
Many thanks,
Daniel Kraft