I need help

I cant find out what happened and I have been stuck on this for a while can anyone help?

Problem:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “class std::basic_string<char,struct std::char_traits,class std::allocator > __cdecl Guess(void)” (?Guess@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function “void __cdecl PrintBack(void)” (?PrintBack@@YAXXZ) Section_2 C:\Users\zcrea\Downloads\Video Game Making C++\Section_2\Section_2\main.obj 1

Script:
#include
#include “FBullCowGame.h”
#include

bool AskToPlayAgain();
void PrintBack();
void Game();
int main();
void PrintIntro();
void PlayGame();
std::string GetGuess();
std::string Guess();


int main()
{
	bool bWantsToPlayAgain = false;
	do {
		PrintIntro();

		PlayGame();

		bWantsToPlayAgain = AskToPlayAgain();

		std::cout << std::endl;
	}
	while (bWantsToPlayAgain);
	return 0;
}

void PrintIntro() {
	//introduction
	constexpr int WORD_LENGTH = 9;
	std::cout << "Welcome to Bulls and Cows! This is a word game\n";
	std::cout << "Can you guess the " << WORD_LENGTH;
	std::cout << " letter of the isogram I'm thinking of???\n";
	std::cout << std::endl;

	return;
}

void PlayGame()
{
	FBullCowGame BCGame;
	int MaxTries = BCGame.GetMaxRetries();
	std::cout << MaxTries << std::endl;

	// loop for the number of turn asking for guesses
	for (int count = 1; count <= MaxTries; count++)
	{
		Game();
		std::cout << std::endl;
	}
}

void Game() {
	GetGuess();
	PrintBack();
	return;

}

std::string GetGuess() {
	//get a guess from the player
	std::cout << "Whats your guess?";
	std::cout << std::endl;
	std::string Guess = "";
	getline(std::cin, Guess);
	return Guess;
}



void PrintBack() {

	// repeat the guess
	std::cout << "Your guess was " << Guess;
	std::cout << " ";
	std::cout << std::endl;
	std::cout << " ";
	std::cout << std::endl;
	return;
}

bool AskToPlayAgain() {
	std::cout << "Do you want to play again?(y/n)\n";
	std::string Response = "";
	getline(std::cin, Response);
	return (Response[0] == 'y') || (Response[0] == 'Y');
	do {
		main();
	} while (Response[0] = 1);
}

I’m not sure if you’ve been able to resolve this yet or if my suggestion will help, but you might try moving the FBullCowGame BCGame; declaration out of the PlayGame method and move it to the top just before the main function. I was having some issues as well and making that change got everything working as it should.
-BB

Thank you so much it works now!

Privacy & Terms