delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/24/05:16:06

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problems Linking
Date: Mon, 24 Jul 2000 08:26:55 GMT
Organization: always disorganized
Lines: 14
Message-ID: <397bfdbb.1707495@news.freeserve.net>
References: <397bb60a_3 AT spamkiller DOT newsfeeds DOT com>
NNTP-Posting-Host: modem-85.banner-wrasse.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 964427215 17543 62.136.227.85 (24 Jul 2000 08:26:55 GMT)
NNTP-Posting-Date: 24 Jul 2000 08:26:55 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

23yrold3yrold wrote:

> Hello. I'm trying to write a game across a few .CPP files, with global
> variables and function prototypes residing in an .H file. If I #include the
> .H file in one .CPP, the others give "undeclared identifier"errors, and if I
> #include in all of them, it gives "multiple declaration" errors. All of
> which I can understand; I just want to find a way to get it all to work
> together. Thanks muchly in advance.

You shouldn't put global variables in the .h file.  Just declare them
(using "extern") in the .h file, and then put the variables themselves
in one (and only one) of the .cpp files.

S.

- Raw text -


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