3abkareeno
3abkareeno

Reputation: 59

error: 'Date' does not name a type?

i know this may be a simple problem, but i have been searching for hours and i cant solve it. i stripped down the project to make it easier to find the problem, here's my code:

Date.h

#ifndef DATE_H
#define DATE_H

Date{
  private:
    int day;
    int month;
    int year;
  public:
    Date();
    Date(int, int, int)
};

#endif // DATE_H

Date.cpp

#include <iostream>
#include "Date.h"
using namespace std;

Date::Date(){
   day = 0;
   month = 0;
   year = 0;
}


Date::Date(int day, int month, int year){
   this->day = day;
   this->month = month;
   this->year = year;
}

main.cpp

#include <iostream>
#include "Date.h"
using namespace std;

int main()
{
   Date d1(14, 2, 15);
   return 0;
}

Upvotes: 0

Views: 2045

Answers (1)

roelofs
roelofs

Reputation: 2170

In Date.h you missed the class keyword in front of the declaration.

Upvotes: 2

Related Questions