Separate compilitaion problem

This is a discussion on Separate compilitaion problem within the C++ Programming forums, part of the General Programming Boards category; Ok, i must be pretty stupid but someone please tell me why the following code Code: #include "date.h" date::date(){ hour=day=month=year=7;} ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    60

    Separate compilitaion problem

    Ok, i must be pretty stupid but someone please tell me why the following code

    Code:
    #include "date.h"
    
             date::date(){
                          hour=day=month=year=7;}
    which is saved in a file named date.cpp cannot be compiled while a have also added in the same project the following date.h file:

    Code:
    #ifndef DATE_H
    #define DATE_H
    
    class date{    // Definition of class Date
    
    public:
           date();
      
    private:
            int hour; //0-23
            int day;
            int month;
            int year;
            }
    
    #endif

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    most likely because you are missing a trailing semicolon after your class declaration:
    Code:
    class date{
    //...
    }; //<---
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    60
    Quote Originally Posted by JaWiB
    most likely because you are missing a trailing semicolon after your class declaration:
    Code:
    class date{
    //...
    }; //<---
    Little details that will get me to suicide one day..
    Thanks a lot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21