www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/15/10:48:04

Message-Id: <m0yPS9W-000S3zC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: "Jason" <dygron AT ace-net DOT com DOT au>, djgpp AT delorie DOT com
Date: Wed, 15 Apr 1998 10:28:28 +0000
MIME-Version: 1.0
Subject: Re: Compiling C and C++ in same project
In-reply-to: <01bd6822$b737b4e0$99a325cb@jring>

"Jason" <dygron AT ace-net DOT com DOT au> wrote:

> 	I have written some code in C++ and would like to add prewritten code and
> object files which were written in C.  Unfortunately, when the linker gets
> hold of the object files compiled under C to be linked with the object file
> compiled unter C++, I get errors saying that the functions defined in the C
> modules do not exist (but they really do!).  Is there a way to link both
> compiler types within the same project or do I have to rewrite them all to
> the same type?  (Also, could someone explain what the difference between
> object files produced by a C compiler, and object files produced by a C++
> compiler?).  Note: I'm using RHIDE to make projects...could this have
> something to do with it?  I'm confused!!!

RHIDE isn't the problem. Just enclose the prototypes of your C code (in the .h 
files) with:

#ifdef __cplusplus
extern "C" {
#endif
....
#ifdef __cplusplus
}
#endif

Like all the standard C headers does.

SET 
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019