I have this code but I keep receiving the unresolved externals error for intiboard? Does anybody have an idea why this is happening? I thought that I did this correctly because I have a function prototype as well as called it in the main function and defined it at the end of the code. And all of the parameters are referenced to. Also i did not include the other definitions to the other function in the program.if I comment out the initboard in my main, the code compiles fine. This is the error I get: error LNK2019: unresolved external symbol "void __cdecl initboard(int * const,int)" (?initboard@@YAXQAHH@Z) referenced in function _main
fatal error LNK1120: 1 unresolved externals
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int size1=80;
const int size2=10;
const int size3=20;
void initboard(int keno[], int size1);//initialize the keno board
void twentnum(int keno[], int size3,int size1);//twenty randomly selected numbers
void matches(int keno[],int guess[],int guess1[],int& numofmatches,int size1,int size2);
void dispkeno(int keno[],int guess1[],int size1);//displays keno board
void dispmess(int guess[], int numofmatches,int size2);
int main()
{
int keno[size1];//keno board array
int guess[size2];//guess array
int guess1[size3];//first guess array
int numofmatches;//number of matches
//This code represents a game keno that chooses twenty random numbers
//from 1-80 and asks the user for 10 numbers from 1-80. The code then
//finds the matches between the users array and the randomly selected
//number array.
initboard(keno,size1);
twentnum(keno,size3,size1);
matches(keno,guess,guess1,numofmatches,size1,size2);
dispkeno(keno,guess1,size1);
dispmess(guess,numofmatches,size2);
return 0;
}
void intiboard(int keno[], int size1)
{
int i;
for(i=1;i<size1+1;i++)
{
keno[i]=0;
}
}
Aucun commentaire:
Enregistrer un commentaire