delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/23/07:31:25

From: "Adrian Smith" <Adrian AT atpelectronics DOT connectfree DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Pointers and Arrays (Newbie.)
Date: Fri, 23 Jun 2000 11:29:15 +0100
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
X-Original-NNTP-Posting-Host: ppp-1-206.cvx3.telinco.net
Message-ID: <39533dab$1@news.telinco.net>
NNTP-Posting-Host: news2.cluster1.telinco.net
X-Trace: 23 Jun 2000 11:32:28 GMT, news2.cluster1.telinco.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Can anybody help me ?

My program has a header file  in which I've got  :-

const char * message = "This is an error message \n"

In the main .cpp file I've got :-

cout << message << endl;

When i try to compile, it comes up with:-

error :<filename.cpp> :  multiple defenition of 'message'

If i use an array - ie, const char message[30] = "This is an error message
\n"
this works perfectly. Could somebody please tell me where Iam going wrong
with the pointer method.

                                            Many thanks.




- Raw text -


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