ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/27/13:45:25

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Jorg" <Jorg DOT Daniels AT pandora DOT be>
Newsgroups: comp.os.msdos.djgpp
Subject: Rhide: multiple definition problem
Lines: 88
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-Mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <ihBy8.42973$Ze.6972@afrodite.telenet-ops.be>
Date: Sat, 27 Apr 2002 17:33:02 GMT
NNTP-Posting-Host: 213.119.36.251
X-Complaints-To: abuse AT telenet DOT be
X-Trace: afrodite.telenet-ops.be 1019928782 213.119.36.251 (Sat, 27 Apr 2002 19:33:02 MET DST)
NNTP-Posting-Date: Sat, 27 Apr 2002 19:33:02 MET DST
Organization: Telenet Internet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,
I just started to work with DJGPP and Rhide.
I have written a test program in Rhide with one class, but i doesn't work.
I've asked in comp.lang.c++ if there are errors in my program, but they say
i must be using the compiler wrongly.

The problem is: I always get multiple definition errors of all my functions,
classes and main(). Here is my post to comp.lang.c++, and the answer:

Jorg" <Jorg DOT Daniels AT pandora DOT be> wrote in message
news:rSzy8.42841$Ze DOT 6912 AT afrodite DOT telenet-ops DOT be...
> Hi,
> Here is a simple test program with one class I tried to write, but my
> compiler complains about multiple definitions. I use djgpp and rhide
1.4.9.
> What's wrong?
>
> Thanks
>
> /// a.h ---------------------------------------
>
> #ifndef a_h
> #define a_h
>
> #include "m.h"
>
> class a
> {
>    public:
>           a();
>           int fa();
>           int value;
> };
>
> #endif // a_h
>
> /// a.cpp ------------------------------------
>
> #include "a.h"
>
> a::a()
> {
>   value=1;
> }
>
> int
> a::fa()
> {
>   value=2;
>   return value;
> }
>
> /// m.h -------------------------------------------
>
> #ifndef m_h
> #define m_h
>
> class a;
>
> #endif //m_h
>
> /// m.cpp ---------------------------------------
>
> #include "m.h"
> #include "a.h"
>
> int main()
> {
>    a* atest = new a();
>    int result = atest->fa();
> }
>
> These are the errors the compiler displays:
> Error: multiple definition of 'a::a()'
> Error: multiple definition of 'a::fa()'
> Error: multiple definition of 'main'
>

There is nothing wrong with your code, you must be using your compiler
wrongly.

john






- Raw text -


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