Hi,
I am getting the following error when I try to compile:
Undefined first referenced
symbol in file
getUserChoice() /var/tmp//ccdG6UVN.o
ld: fatal: symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
I have looked it up online and am guessing that it is a library linker error, but I do not know how to fix it. I am wondering why it is saying there is an error with getUserChoice() and not getComputerChoice as they are written and used in the same way. Any help or explanation would be appreciated. This is for a class I am taking in c++ so I am at a very "beginner level" and still trying to understand everything. Thank you for your time!
#include <iostream>
#include <string>
using namespace std;
// Functions used for program
void displayGameDetails();
void playGame();
string getComputerChoice();
string getUserChoice();
string getChoiceAsString(int);
void displayChoices(string, string);
string findWinner(string, string);
int main()
{
displayGameDetails();
playGame();
system("pause");
return 0;
}
void displayGameDetails()
{
cout << "Lets play rock paper scissors!" << endl;
"ajanch6project.cpp" 134 lines, 2303 characters
{
cout << "Lets play rock paper scissors!" << endl;
}
string GetUserChoice()
{
int usr;
string usrChoice;
cout << "The computer has already chosen, now it is your turn" << endl;
cout << "Type 1 for Rock, 2 for Paper, 3 for Scissors" << endl;
cin >> usr;
while(usr!=1 && usr!=2 && usr!=3)
{
cout << "Invalid, enter 1, 2, or 3 only" << endl;
cin >> usr;
}
usrChoice = getChoiceAsString(usr);
return usrChoice;
}