About Store Forum Documentation Contact



Post Reply 
identifier not found?
Author Message
runewake2 Offline
Member

Post: #1
identifier not found?
I'm curious what this error means? I am getting it in my code (just a part of it). Don't be too mean on the structure of it all:

Code:
Char16 MarkButton(int ButtonNumb)
{
   Char16 orig_value = '?';
   if (ButtonNumb == 1) orig_value = button_1.text.first();
   else if (ButtonNumb == 2) orig_value = button_2.text.first();
   else if (ButtonNumb == 3) orig_value = button_3.text.first();
   else if (ButtonNumb == 4) orig_value = button_4.text.first();
   else if (ButtonNumb == 5) orig_value = button_5.text.first();
   else if (ButtonNumb == 6) orig_value = button_6.text.first();
   else if (ButtonNumb == 7) orig_value = button_7.text.first();
   else if (ButtonNumb == 8) orig_value = button_8.text.first();
   else if (ButtonNumb == 9) orig_value = button_9.text.first();
   if (turn == true && orig_value != 'O')
   { //If can place then next turn and check for victory.
      IncrementTurn();
      if (turn == true) current_pick = 'X';
      else current_pick = 'O';
      return current_pick;
   } //Otherwise just wait for valid move.
   else return orig_value;
}
/******************************************************************************/
void IncrementTurn() //Will change whos turn it is and check for victory
{
   turn = !turn;
   //Check for victory:
   Bool Victory1 = VictoryCheck(player1_Mark);
   if (Victory1)
   {
      button_1.text = "X";
      button_2.text = "X";
      button_3.text = "X";
      button_4.text = "X";
      button_5.text = "X";
      button_6.text = "X";
      button_7.text = "X";
      button_8.text = "X";
      button_9.text = "X";
      p1_vic ++;
      winner = 1;
      return;
   }
   Bool Victory2 = VictoryCheck(player2_Mark);
   if (Victory2)
   {
      button_1.text = "O";
      button_2.text = "O";
      button_3.text = "O";
      button_4.text = "O";
      button_5.text = "O";
      button_6.text = "O";
      button_7.text = "O";
      button_8.text = "O";
      button_9.text = "O";
      p2_vic ++;
      winner = 2;
      return;
   }
}
/******************************************************************************/
Bool VictoryCheck(Char16 CheckChr)
{
   //Check for Victory on each possible lane
   if (button_1.text.first()==CheckChr && button_2.text.first()==CheckChr && button_3.text.first()==CheckChr) return true;
   else if (button_4.text.first()==CheckChr && button_5.text.first()==CheckChr && button_6.text.first()==CheckChr) return true;
   else if (button_7.text.first()==CheckChr && button_8.text.first()==CheckChr && button_9.text.first()==CheckChr) return true;
   else if (button_1.text.first()==CheckChr && button_4.text.first()==CheckChr && button_7.text.first()==CheckChr) return true;
   else if (button_2.text.first()==CheckChr && button_5.text.first()==CheckChr && button_8.text.first()==CheckChr) return true;
   else if (button_3.text.first()==CheckChr && button_6.text.first()==CheckChr && button_9.text.first()==CheckChr) return true;
   else if (button_1.text.first()==CheckChr && button_5.text.first()==CheckChr && button_9.text.first()==CheckChr) return true;
   else if (button_7.text.first()==CheckChr && button_5.text.first()==CheckChr && button_3.text.first()==CheckChr) return true;
   else return false;
}

My error is this:
Quote:1>c:\esenthel\esenthelenginesdk\tutorials\source\tic tac toe.cpp(59) : error C3861: 'IncrementTurn': identifier not found
1>c:\esenthel\esenthelenginesdk\tutorials\source\tic tac toe.cpp(71) : error C3861: 'VictoryCheck': identifier not found
1>c:\esenthel\esenthelenginesdk\tutorials\source\tic tac toe.cpp(87) : error C3861: 'VictoryCheck': identifier not found

At first I thought it meant that I had spelled the function name wrong and it couldn't find it. This does not seem to be the case however since the spelling is correct.

I know that the error should be a relatively easy fix but I can't find it.


EDIT: I found my solution here: http://www.codeguru.com/forum/showthread.php?p=1775065.
I didn't know that C++ did that. Weird that it doesn't bother to look for the function in the rest of the code, but, what do I know?
(This post was last modified: 12-01-2010 03:26 AM by runewake2.)
12-01-2010 02:43 AM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #2
RE: identifier not found?
Yup, you just needed a forward declaration
12-01-2010 03:43 AM
Find all posts by this user Quote this message in a reply
Post Reply