delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/06/05:58:54

Date: Thu, 6 Jan 2000 14:57:09 +0500 (MVT)
From: Prashant TR <prashant_tr AT yahoo DOT com>
To: Aaron Chernosky <chernobl AT wt DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: C++, Multiple Files, Classes
In-Reply-To: <00010614263100.00523@yahoo>
Message-ID: <Pine.LNX.4.10.10001061452490.526-100000@yahoo.com>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 5 Jan 2000, 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?

You are probably trying to include header.cpp from header.cpp itself!

Prashant
---------------------------------------------------
One pound of learning requires ten pounds of common
sense to apply it.

- Raw text -


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