X-Spam-Check-By: sourceware.org Date: Thu, 11 May 2006 16:52:16 -0700 From: clayne AT anodized DOT com To: cygwin AT cygwin DOT com Cc: klaas DOT thoelen AT telenet DOT be Subject: Re: how come #include "*.cpp" works? Message-ID: <20060511235216.GR18330@ns1.anodized.com> References: <44638BED DOT 5020009 AT telenet DOT be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44638BED.5020009@telenet.be> User-Agent: Mutt/1.5.11 X-Assp-Spam-Prob: 0.00000 X-Assp-Whitelisted: Yes X-Assp-Envelope-From: clayne AT ns1 DOT anodized DOT com X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Thu, May 11, 2006 at 09:09:33PM +0200, Klaas Thoelen wrote: > > This seems a little strange to me. Does anybody know what's wrong here? > > Thanks and regards, > Klaas Thoelen It's just a classic mistake, pretty easily fixed with the following: > datum.h > ****** Add this: #ifndef DATUM_H #define DATUM_H > class Date { > public: > Date(); > Date(int dd, int mm, int yy); > int day(); > int month(); > int year(); > static void set_default(int, int, int); > Date& add_year(int); > Date& add_month(int); > Date& add_day(int); > Date& print(); > private: > int d, m, y; > static Date default_date; > static bool is_leapyear(int); > static int daysinmonth(int, int); > }; #endif /* DATUM_H */ That ifndef construct is a one-way trap-door to prevent a doubly included file from clobbering itself. Pretty standard. > > datum.cpp > ******** > #include "datum.h" Probably should place this after your standard includes below. > #include > #include > using namespace std; -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/