delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/27/07:51:43

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointers and Arrays (Newbie)
Date: Tue, 27 Jun 2000 11:09:36 GMT
Organization: always disorganized
Lines: 48
Message-ID: <39588b61.13985194@news.freeserve.net>
References: <39535e20 AT news DOT telinco DOT net> <39587ba3$1 AT news DOT telinco DOT net>
NNTP-Posting-Host: modem-18.cirdan.dialup.pol.co.uk
X-Trace: news8.svr.pol.co.uk 962104177 15401 62.136.147.146 (27 Jun 2000 11:09:37 GMT)
NNTP-Posting-Date: 27 Jun 2000 11:09:37 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

Adrian Smith wrote:

> Sorry to be a pain, but I thought I'd solved the problem when I hadn't.
> I've realised where the problem lies but I can't work out why.

Change test.h to:


#ifndef TEST_H
#define TEST_H

void show(void);
extern const char * message;

#endif


and test.cpp to:


#include <iostream>
#include "test.h"

using namespace std;

const char * message = "This is a message";

int main(void)
{
   show();
   cout << message << endl;
   return 0;
}


And test2.cpp to:


#include <iostream>
#include "test.h"

using namespace std;

void show(void)
{
    cout << message << endl;

}

- Raw text -


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