www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/29/01:46:59

Date: Sat, 29 Mar 1997 00:43:09 -0600 (CST)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: deltaman AT swipnet DOT se
cc: DJGPP ML <djgpp AT delorie DOT com>
Subject: Re: Multiple-file problem
In-Reply-To: <333C3C43.7216@geocities.com>
Message-ID: <Pine.SUN.3.95.970329004134.24135B-100000@ernie.eecs.uic.edu>
MIME-Version: 1.0

In your header file right on top before everything put 
#ifndef __WHAT_EVER_NAME_YOU_WANT_TO_USE
#define __WHAT_EVER_NAME_YOU_WANT_TO_USE

and at the very end put
#endif
I hope this helps.

On Fri, 28 Mar 1997, Deltaman wrote:

> Hi!
> 
> My program have gotten reasonably big, so I decided to split it. I now
> have 'header.h' which contains the prototypes for all functions,
> 'mainprog.c' which contains void main() and some often updated functions
> and 'somefunc.c' which has some fundamental functions.
> 
> In 'somefunc.c' I include 'header.h' and 'mainprog.c' and in
> 'mainprog.c' I include 'header.h'. It compiles perfectly (in RHIDE) but
> when I links it I get the error messages:
> 
> mainprog.c(a number)    Error: multiple definition of <function>
> somefunc.c(same number) Error: first defined here
> 
> This happens with all functions (even main) in 'mainprog.c'. What should
> I do to make it work?
> ------------------------------------------------------------------------
> mailto:deltaman AT swipnet DOT se
> 
> Please visit my homepage at http://www.geocities.com/TimesSquare/8240
> ------------------------------------------------------------------------
> ______  _______        _______ _______ _______ _______ __   _
>  |     \ |______ |         |    |_____| |  |  | |_____| | \  |
>  |_____/ |______ |_____    |    |     | |  |  | |     | |  \_|
> 
> 

- Raw text -


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