Unresolved external referenced from

Hi guys. I have encountered a strange error which is probably neither synthax nor logical. It is related to improper usage of functions i suppose.
Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//---------------------------------------------------------------------------
#include<iostream.h>
#include<conio>
#pragma hdrstop
int rollDice();
int krepsStat (void);
int process (int);
//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{ const int arraySize = 1000;

   cout << "Playing kreps 1000 times gives us the following statistic: \n";
  int i, masskrep [arraySize],win=0,loss=0;
  randomize();
  for (i=0;i<arraySize;i++)
  {masskrep[i] = krepsStat();
   if (masskrep[i] == 1)
       win++;
   else
       loss++;}
  cout << "Amount of wins is " << win<<endl<<"Amount of losses is "<<loss<<endl;
  getch();
        return 0;
}
//---------------------------------------------------------------------------
int krepStat()
{
  int gameStatus;
 int sum;
 sum = rollDice();
 gameStatus = process(sum);

 if (gameStatus == 1)
     return 1;
 else
     return 0;
}
int rollDice()
{
 int die1 = 1 + rand()%6;
 int die2 = 1 + rand()%6;
 int dice = die1 + die2;
 return dice;
}
int process (int sum1)
{ int gameStatus1,myPoint;
  switch (sum1){
         case 7:
         case 11:
              gameStatus1 = 1;
              break;
         case 2:
         case 3:
         case 12:
              gameStatus1 = 0;
              break;
         default:
              gameStatus1 = 2;
              myPoint = sum1;
              break;
              }
  while (gameStatus1 == 2) {
        sum1 = rollDice();
        if (sum1 == myPoint)
            gameStatus1 = 1;
        if (sum1 == 7)
           gameStatus1 = 0;}
           return gameStatus1;
}


and this is the message of the mistake:
[Linker Error] Unresolved external 'krepsStat'referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\KREPS2\UNIT1.OBJ

If someone can explain me what is going on and what should i do to correct this code and how to escape these mistakes in future it would be really appreciated. Thank you very much in advance.
Meh, looks like a spelling error. You seem to be missing an 's' from the function declaration of krepsStat on line 28.
Last edited on
Topic archived. No new replies allowed.