Game Development Community

Undeclared identifier

by Alexander Porter · in Torque Game Engine · 03/31/2002 (12:25 pm) · 4 replies

why do i get this error " undeclared identifier "
whenever i make any changes to the engine, then when i undo my changes, it continues to happen. it only stops when i reload all the engine files.....
help please?

#1
03/31/2002 (1:14 pm)
As you may or may not know, this error equates to you refering to a variable (or identifier) that you have not defined.

If you give specific details of your problem then perhaps someone can help but with such a vague description I think you've got no chance.

Post more details and I'll help if I can.
#2
03/31/2002 (1:24 pm)
sorry. i just reinstalled the build and ill let you know next time. but it wasnt for anything new. it usually happens when i follow a tutorial, this one was for the "increase fluid rendering by 5%" one and as soon as i undid whatever i had changed, it still gave the same error, it also happened when i tried to follow emo's jetpack love tutorial.
#3
11/05/2008 (8:50 am)
Bumping an old thread, similar question.

I'm following the server-side melee tutorial by Josh Moore.

When I build, I get the error

...shapebase.cc(887) : error C2065: 'vecStart' : undeclared identifier

Isn't this declaring it in shapeImage.cc?

//--code
void ShapeBase::UpdateImageRaycastDamage(F32 dt, U32 imageSlot)
//...edited for space
VectorF vecStart = startTrans.getPosition();
//--edited for space
//--end code

If so, then why the error?
If not, what is the correct way to declare it?

Thanks!

Tony
#4
11/05/2008 (10:14 am)
Make sure you're not declaring it in one spot and then using it out of scope.

example

function goo()
{
     int x = 0; //declared in the scope of the function
     
     if(x)
     {
          x += 1;  //still in scope
          int a = x;  //declared in the scope of the if statement
     }

     echo(a);  //no longer in scope, undeclared identifier
}