Reputation: 21
I'm currently working on an entry level C++ project to code the game mastermind (a secret code is generated and the user tries to crack it). We are just learning the basics of C++ (OOP, arrays and vectors, etc.), so the code seems to work fine. However, everytime I attempt to compile my .cpp files for the 3 classes I have, each one has some error I have never seen referring to WinMain, right here
18 C:\crossdev\src\mingw-w64-v3-git\mingw-w64-crt\crt\crt0_c.c undefined reference to `WinMain' C:\Users\xxx\OneDrive\Desktop\xxx\collect2.exe [Error] ld returned 1 exit status
This is the universal error message across the 3 .cpp files, the header files and main file compile fine. Any ideas what went wrong? I've done a couple assignments similar to this no problem...
Heres the code to one of the classes for reference
#include "response.hpp"
using namespace std;
response::response()
{
numCorrect = 0;
numIncorrect = 0;
}
response::response(int correct, int incorrect)
{
numCorrect = correct;
numIncorrect = incorrect;
}
int response::getNumCorrect()
{
return numCorrect;
}
int response::getNumIncorrect()
{
return numIncorrect;
}
void response::setCorrect(int correct)
{
numCorrect = correct;
}
void response::setIncorrect(int incorrect)
{
numIncorrect = incorrect;
}
bool operator == (const response& lhs, const response& rhs)
{
return ((lhs.numCorrect == rhs.numCorrect) && (lhs.numIncorrect == rhs.numIncorrect));
}
ostream& operator << (ostream& ostr, const response& out)
{
ostr << "Correct: " << out.numCorrect << endl;
ostr << "Incorrect: " << out.numIncorrect << endl;
return ostr;
}
Upvotes: 0
Views: 277