Advertisement

Simple Question...

Started by July 27, 2000 07:40 PM
2 comments, last by JSCFaith 24 years, 4 months ago
Hey, Well im haveing problems with this one line of code, I get these 3 errors: : error C2018: unknown character '0x96' : error C2143: syntax error : missing ')' before 'constant' : error C2059: syntax error : ')' They all point to the same line, here is the code.
                
// These were defined earlyer in the program.


#define TILE_SIZE     32

 #define WORLD_SIZEX   12

 #define WORLD_SIZEY   12

void draw_tiles(void)
{
  int tile = 0;
  int x = 0;
  int y = 0;

  RECT tile_src;

  for (x = 0; x < WORLD_SIZEX; x++)
  {
    for (y = 0; y < WORLD_SIZEY; y++)
    {
      tile = map[x][y];    // tile now stores the ID of this particular tile


      tile_src.left    =  (tile – 1) * TILE_SIZE; /*<- This is the line that I get all the errors at.*/
      tile_src.top     =  0;
      tile_src.right   =  tile * TILE_SIZE;
      tile_src.bottom  =  TILE_SIZE;

	  lpDDSBack->BltFast(x * TILE_SIZE, y * TILE_SIZE, lpddsoffscreen, &tile_src, NULL);
    }
  }
}
                
Could someone please help me, I dont see anything wrong with it. Edited by - JSCFaith on 7/27/00 7:44:09 PM Edited by - JSCFaith on 7/27/00 7:44:46 PM
I don''t see any problem either...which line numbers are the errors referring to?

Which one is line number 2018?
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Advertisement
I''ve had infuriating problems like this before. Although I can''t guarantee this will fix your problem I can share an idea that might help. As you know, the preprocessor is pretty brainless. In mindlessly expands and replaces macros and such.

The problem I''ve had before is that if something is defined wrong before the #define (syntax error, missing ; or something), then when the preprocessor replaces the macro, it will put the error everywhere it replaces. So my suggestion is to check the syntax around the #define statements that define TILE_SIZE or whatever it is called.

Hope that helps.
just retype the - sign. It's a code source bug. It happens somethimes. if you try to copy and paste the line in you ide, you'll see that the - sign is an happy black box, simply meaning that even though the source file was displayed properly, the internel was wrong. The error message is very clear on that :

unknow character 0x96 wich give in decimal 150 wich is not - sign, it's not even an ascii character.

It happened to me a couple of times and it is annoying. If just the changing - sign doesn`t work, just delete the whole line and rewrite it again.

Edited by - Gorg on July 27, 2000 11:22:33 PM

This topic is closed to new replies.

Advertisement