gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > values undeclared..

#35492 - Mitch GBA - Sat Feb 05, 2005 2:41 pm

Code:


...

//values\\
u16 left = 0;


//input\\

void GetInput(void)
{

   if(!(*KEYS & KEY_UP) && left == 0 )
   {
      sprites[3].attribute2 = 512+16;
   }

}

...



Why do I get the error here, that 'left is undeclared' ???

#35496 - MumblyJoe - Sat Feb 05, 2005 3:51 pm

My guesses would be:

a) u16 isn't typedefed/defined.

b) u16 is in another namespace.

If you could post the actual error message as gcc shows it I may be of more help.
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#35507 - Mitch GBA - Sat Feb 05, 2005 6:20 pm

I thought that too, and I'll look into it. Maybe I didn't include a header file.. If I dont get it right, I'll post the error. Thanks :)

#35508 - Mitch GBA - Sat Feb 05, 2005 6:40 pm

still not working. It sais exactly, undeclared, because first use in this function...

#35519 - Celeryface - Sun Feb 06, 2005 1:16 am

Mitch GBA wrote:
still not working. It sais exactly, undeclared, because first use in this function...


Have you tried renaming that variable to something else? I've run into some similar problems when another global variable had the same name.

#35536 - sajiimori - Sun Feb 06, 2005 6:27 pm

If it still doesn't work, pare down the program to the smallest portion that has the problem and post the entire thing verbatim.