I'm trying to initialize Date
, maybe I forgot something about it. I follow Bjarne Stroustrup's book but cannot run this code.
#include <iostream>
using namespace std;
struct Date
{
int y, m, d; // year, month, day
Date(int y, int m, int d); // check for valid & initialize
void add_day(int n); // increase the Date by n days
};
int main()
{
Date today(2021, 1, 6);
return 0;
}
Here is the error which I don't know how to fix it probably:
undefined reference to `Date::Date(int, int, int)'
collect2.exe: error: ld returned 1 exit status