My constructor has a green line underneath it saying "function definition not found".
Visual Studio has given me a fix, but I want to know why mine doesn't work.
#pragma once
#include "class_dayType.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
dayType day;
string d;
cout << "Enter day of week: ";
cin >> d;
day.set_day(d);
}
#include <iostream>
#include<string>
using namespace std;
class dayType {
public:
string day;
dayType(); //constructor with green line
void set_day(string day_of_week) {
string day = day_of_week;
}
};
Visual Studio created this in another file and it worked. What is the difference between this and my constructor?
dayType::dayType()
{
}
Errors:
LNK2019 unresolved external symbol "public: __thiscall dayType::dayType(void)" (??0dayType@@QAE@XZ) referenced in function _main Day_of_Week
LNK1120 1 unresolved externals Day_of_Week