Newsgroups: comp.os.msdos.djgpp From: manni DOT heumann AT gmx DOT de (Manni Heumann) Subject: Re: C++, Multiple Files, Classes References: <3873FF7B DOT DFB48EA2 AT wt DOT net> X-Newsreader: News Xpress 2.01 Date: Thu, 06 Jan 2000 09:30:24 GMT NNTP-Posting-Host: dhcp33-226.uni-bielefeld.de Message-ID: <387460b5@news.uni-bielefeld.de> X-Trace: 6 Jan 2000 10:30:29 +0200, dhcp33-226.uni-bielefeld.de Lines: 39 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <3873FF7B DOT DFB48EA2 AT wt DOT net>, Aaron Chernosky wrote: >I have a header file with a class declaration in it, for ex this: > Did you try to compile this? On my system it compiles without complaints (if you change the inlcude to include). What you are doing here is legal, but really bad style. You should never include a source file, always include the header files! Btw: Which compiler are you using? Since when does gcc say "Error:" when it encounters an error? >-- 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 -- Manni