D:\C++ Files\Lab05-03RockPaperScissorsSol\Debug\Lab05-03RockPaperScissorsProj.exe : fatal error LNK1120: 1 unresolved externals
and
Main.obj : error LNK2019: unresolved external symbol "int __cdecl getComputerChoice(int)" (?getComputerChoice@@YAHH@Z) referenced in function _main
Any help with either of these would be greatly appreciated. I've tried to recreate my project, put different parts of the code into comments to check if any were causing the problem specifically, made sure I was in win32 format, and so on to no avail. I first tested the getUserChoice() function (line 41) and had no problems. The problems started arising after I created the second function, getComputerChoice() (line 54). Thanks in advance for any help. Here's my code so far:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
const int ROCK = 1;
const int PAPER = 2;
const int SCISSORS = 3;
int getUserChoice(int userChoice);
int getComputerChoice(int computerChoice);
void determineWinner (int, int);
void displayChoice(int);
int main()
{
int userChoice;
int computerChoice;
unsigned seed = time(0);
srand(seed);
computerChoice = getComputerChoice(computerChoice);
userChoice = getUserChoice(userChoice);
cout << computerChoice << endl << userChoice;
while (userChoice != 4)
{
determineWinner(userChoice, computerChoice);
computerChoice = getComputerChoice();
userChoice = getUserChoice();
}
system("pause");
return 0;
}
int getUserChoice(int)
{
int userChoice;
cout << " Game Menu \n" << "---------- \n";
cout << "1) Rock" << endl << "2) Paper" << endl << "3) Scissors" << endl << "4) Quit" << endl;
cout << "Enter your choice: ";
cin >> userChoice;
return userChoice;
}
int getComputerChoice()
{
int computerChoice;
unsigned seed = time(0);
srand(seed);
computerChoice = 1 + rand() % 3;
return computerChoice;
}

New Topic/Question
Reply




MultiQuote




|