I've been searching around for a solution and I came across this one: https://stackoverflow.com/a/12574400/13991027 I followed the steps but it still does not seem to work.
I have made projects in the past with VS and this is the first time I have gotten this error. My code is fairly short, so I don't think it is an error with the code. main.cpp:
#include <iostream>
#include "menu.h"
int main()
{
int mode = menu();// 1 == easy, 2 == medium, 3 == hard
}
menu.h:
#ifndef MENU_H
#define MENU_H
int menu();
#endif
menu.cpp
#include <iostream>
int menu()
{
// Store user input in mode choice
std::string modeChoice;
std::cout << "Please select one of the following to begin:\n";
std::cout << "-Easy\n -Medium\n -Hard\n";
// Check for correct input
do
{
std::cout << "Enter a difficulty here:";
std::cin >> modeChoice;
for (int i = 0; i < modeChoice.length(); i++)
{
if (modeChoice[i] >= 'A' && modeChoice[i] <= 'Z')
{
modeChoice[i] += 32;
}
}
} while (modeChoice != "easy" || modeChoice != "medium" || modeChoice != "hard");
if (modeChoice == "easy")
{
return 1;
}
else if (modeChoice == "medium")
{
return 2;
}
else
{
return 3;
}
}
Here is the output tab:
1>------ Build started: Project: project, Configuration: Debug Win32 ------
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>C:\Users\bobb\Desktop\hangman\Debug\project.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "project.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========