Please help with my Undefined Reference errors!

I am trying to make a program that implements a date class. All it does is print the date constructed by the default constructor. However, why are my main functions getting "undefined reference" errors? Also, If i wanted to implement certain rules on the values of month year and day(eg. day cannot be less than 0 or larger than 30) where would that part of the code? My guess is in the class definition in the header file but I am unsure. Any help is greatly appreciated!

MAIN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include "Date.h"

using namespace std;

int main()
{
    int x,y,z;
    Date MyDate;

    cout<<"Welcome to my Date increment program!!"<<endl;
    cout<<"Please enter a month number of your date to start:";
    cin>>x;
    cout<<"Enter the day number of your date:";
    cin>>y;
    cout<<"Enter year:";
    cin>>z;

    MyDate.setDate(x,y,z);
    MyDate.printDate();

    return 0;
}


DATE.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include "Date.h"

using namespace std;

Date::Date()
{
    year = 2000;
    month = 1;
    day = 1;
}


void Date::setDate(int x,int y,int z){
    month = x;
    day = y;
    year = z;
}

void Date::printDate(){
    cout<<month<<"/"<<day<<"/"<<year;
}

int Date::getMonth(){
    return month;
}

int Date::getDay(){
    return day;
}

int Date::getYear(){
    return year;
}

Date::~Date()
{

}


Date.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef DATE_H
#define DATE_H


class Date {
    private:
        int month,day,year;
    public:
        Date();
        ~Date();
        void setDate(int,int,int);
        void printDate();
        int getMonth();
        int getDay();
        int getYear();
};



#endif // DATE_H 

nevermind! I found out it was a compile error on my part..
Topic archived. No new replies allowed.