delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/08/26/19:38:29

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Thu, 26 Aug 2004 19:37:33 -0400
Message-Id: <200408262337.i7QNbXEt031947@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <1093560759.721269@proxy2.srv.ualberta.ca>
(jdhanley AT telusplanet DOT net)
Subject: Re: errors when linking
References: <1093551837 DOT 155041 AT proxy2 DOT srv DOT ualberta DOT ca> <200408262048 DOT i7QKmVUP029709 AT envy DOT delorie DOT com> <1093560759 DOT 721269 AT proxy2 DOT srv DOT ualberta DOT ca>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I was under the impression that if you #include your .h file, the
> declaration is included at compile time in your .c file.  I am not
> quite sure I understand why I would need to declare them twice.

This isn't djgpp-specific, but to summarize:

--- foo.h ---
extern int i;
extern int f();

--- a.c ---
#include "foo.h"

int v()
{
  i = f();
}

--- b.c ---
#include "foo.h"

int i;

int f()
{
}

- Raw text -


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