www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/06/02:29:05

From: Mark Cowan <mark DOT cowan AT studentmail DOT newcastle DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++, Multiple Files, Classes
Date: Thu, 06 Jan 2000 17:10:44 -0800
Organization: The University of Newcastle
Lines: 43
Message-ID: <38753D14.817604E7@studentmail.newcastle.edu.au>
References: <3873FF7B DOT DFB48EA2 AT wt DOT net>
NNTP-Posting-Host: c53h3-asy102.newcastle.edu.au
Mime-Version: 1.0
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm no C++ guru but I suspect your problems come from this:

1) instead of calling your header file header.h,  try calling it MyClass.h

2) Then in your cpp file you should
#include "MyClass.h"
instead of #include "header.cpp"

Mark
--
_____________________________________________

Mark Cowan
Newcastle Australia

Aaron Chernosky wrote:

> I have a header file with a class declaration in it, for ex this:
>
> -- header.h --
>
> class MyClass {
>   public:
>     MyClass();
>     ~MyClass();
> };
>
> #inlcude "header.cpp"
>
> -- header.cpp --
>
> MyClass::MyClass() { }
>
> MyClass::~MyClass() { }
>
> ----------------
>
> When I include the header file into my main program and try to compile
> it, the error "Error: syntax error before '::'" numerous times, once for
> each function that's in the class.  What is causing this?
>
> Aaron C

- Raw text -


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