www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/07/04:41:06

Message-ID: <3732A1B1.CB374358@softhome.net>
From: Chris Mears <chris_mears AT softhome DOT net>
X-Mailer: Mozilla 4.04 [en] (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ASAP: class header files
References: <926037273 DOT 027 DOT 43 AT news DOT remarQ DOT com>
Lines: 24
Date: Fri, 07 May 1999 18:17:53 +1000
NNTP-Posting-Host: 139.134.192.177
X-Trace: newsfeeds.bigpond.com 926064676 139.134.192.177 (Fri, 07 May 1999 18:11:16 EST)
NNTP-Posting-Date: Fri, 07 May 1999 18:11:16 EST
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Shaggs wrote:
> 
> I need the full details on making a c++ header.
> 
> From my main program file i have:
> 
> #include "myclass.h"
> 
> myclass *mine = new myclass;
> 
> I keep getting errors saying stuff like:
> undefined reference to myclass::myclass(void)
> But its defined in the header, and the code is in the .cpp source

The header's ok, apparently.  The problem seems to be in the linking
stage.  Make sure you link the class implementation correctly with the
main program.  Try something like this:

gcc mainprog.cpp myheader.o

Chris

> 
> also, how do i properly use #ifdef for the header file

- Raw text -


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