delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/25/16:31:51

From: "yogin" <yogin AT polbox DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <3812BDDA DOT E709C2E1 AT hjc DOT edu DOT sg>
Subject: Re: Linking problem
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2417.2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <uZ2R3.32869$Tk.585193@news.tpnet.pl>
Date: Mon, 25 Oct 1999 20:21:46 GMT
NNTP-Posting-Host: 212.160.48.205
X-Complaints-To: abuse AT tpsa DOT pl
X-Trace: news.tpnet.pl 940882906 212.160.48.205 (Mon, 25 Oct 1999 22:21:46 MET DST)
NNTP-Posting-Date: Mon, 25 Oct 1999 22:21:46 MET DST
Organization: TPNET - http://www.tpnet.pl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>     I defined two classes call "cPoint" and "cRect" in a header
> file(crect.h). I also implemented them in the same file because I wanted
> to utilise the function inlining ...the linker
> gave me something like "multiple declaration cRect::cRect()" and similar
> ones for the rest of the constructors.
>
> (tinline.h)
>
> #ifndef __TEST123_H
> #define __TEST123_H
>
> class TInline {
> public:
>   TInline();
> ~TInline();
> };
>
> TInline::TInline() { /* empty */ }
> TInline::~TInline() { /* empty */ }
>
> #endif

According to the C++ reference, if you want to use inline class
implementation, the desired functions must be implemented in class
definition. Your class schould look this way:

class TInline {
 public:
  TInline() { /* empty */ };
 ~TInline() { /* empty */ };
 };

it works (I've checked). And of course remember about #ifdef....#endif
enclosing your header file. Happy coding!

yogin





- Raw text -


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