Not working. 1 Unresolved externals

// BullCowGame.cpp : Defines the entry point for the console application.
//
#include “stdafx.h”
#include
#include

using namespace std;

void PrintIntro();
string GetGuessAndPrintBack();

int Main()
{
PrintIntro();
GetGuessAndPrintBack();
GetGuessAndPrintBack();
cout << endl;
return 0;
}

// introduce the game
void PrintIntro()
{
constexpr int WORD_LENGTH = 9;
cout << “Welcome to Bulls and Cows a pretty **** word game.\n”;
cout << “Can you guess the word i am thinking of?\n”;
cout << “The word is " << WORD_LENGTH;
cout << " characters long\n”;
cout << endl;
return;
}

string GetGuessAndPrintBack()
{
string Guess = “”;
cout << “Please input your guess:\0”;
getline(cin, Guess);
cout << “Your Guess was '” << Guess << “’.Is this your final answer?:” << endl;

return Guess;

}

So found the issue.

Not sure why it fixed it but changing my “Main” to “main” worked. Even though i did all my naming from the beginning using “Main”.

Maybe someone knows something i dont :slight_smile:

I think the main issue is that C++, like a lot of programming languages, is very much case sensitive. Thus the functions main() and Main() are two different things, and the C++ compiler is looking specifically for main() as the opening point.

Privacy & Terms