delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/23/09:46:00

From: "Simon Sulser" <simonsulser AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointers and Arrays (Newbie)
Date: Fri, 23 Jun 2000 15:29:25 +0200
Organization: Usenet provided by sunrise communications ag
Lines: 21
Message-ID: <8ivoqt$imj$1@news1.sunrise.ch>
References: <39535e20 AT news DOT telinco DOT net>
NNTP-Posting-Host: pop-zh-9-1-dialup-226.freesurf.ch
X-Trace: news1.sunrise.ch 961767069 19155 194.230.192.226 (23 Jun 2000 13:31:09 GMT)
X-Complaints-To: usenet AT sunrise DOT ch
NNTP-Posting-Date: 23 Jun 2000 13:31:09 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

You should only put declarations in header files and all definitions in
cpp-files. Maybe you included your header several times in different cpp
files.

-- header file --

// decleration
extern char const * message;

-- cpp file --

#include "header.h"

// definition
char const *message = "Blablablabla";

Of course if you only need message in one cpp file you don't have to write
the declaration into a header file at all. You can even declare it as
static, which means it's local to this cpp file.


- Raw text -


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