Jump to content

  • Log In with Google      Sign In   
  • Create Account


Two-dimensional array map error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 iGoogleThis   Members   -  Reputation: 205

Like
0Likes
Like

Posted 12 March 2013 - 07:32 PM

How's it going everyone,  I'm having some bug issues with a two-dimensional array I'm using for a general map layout.  Hell, actually the whole functiion seems kooky.  MAP_WIDTH and MAP_HEIGHT are both pre-defined as well as a prototype for the function itself.  Every other function in the code seem to be working except this one (but you know how C is).  The errors are:

 

main.c: In function ‘main’:
main.c:33:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
main.c:34:69: error: expected ‘;’ before ‘}’ token
main.c:34:70: error: expected expression before ‘,’ token
main.c:57:5: error: expected ‘;’ before ‘{’ token

 

all of which I've gotten before,  which leads to think it has something to do with line 33.  I've tried random little things like semicolons after the closing ( } ) curly bracket but no luck.  Anything I'm missing here?  I don't do these often.

 

int aMapArray[MAP_HEIGHT][MAP_WIDTH] {
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 }


Edited by iGoogleThis, 13 March 2013 - 04:18 PM.

Chris LeJohn

Build Engineer (RE)
Gnovahex Computing


Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9561

Like
2Likes
Like

Posted 12 March 2013 - 07:41 PM

You're missing an = before the first {.

#3 ultramailman   Prime Members   -  Reputation: 1563

Like
2Likes
Like

Posted 12 March 2013 - 07:45 PM

You're missing a ; after the last }.



#4 iGoogleThis   Members   -  Reputation: 205

Like
0Likes
Like

Posted 12 March 2013 - 07:56 PM

You're missing an = before the first {.

laugh.png  winnn thanks a lot!

 

You're missing a ; after the last }.

So that was part of the solution!  Thanks!  Sure enough that did it. 

 

Nothin' better than a successful compile, drinks on me.


Chris LeJohn

Build Engineer (RE)
Gnovahex Computing


#5 Khatharr   Crossbones+   -  Reputation: 2963

Like
0Likes
Like

Posted 12 March 2013 - 11:41 PM

We need a forum badge system that includes the badge 'Eagle-Eye'. I started at that line for a full 215 seconds and totally missed the '=' not being there.

 

Maybe it's bedtime...


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#6 SiCrane   Moderators   -  Reputation: 9561

Like
0Likes
Like

Posted 13 March 2013 - 06:02 AM

It's not that hard if you read the error message, which basically says a { isn't legal here, but you can use an = (or a ,; asm or __attribute__).

#7 iGoogleThis   Members   -  Reputation: 205

Like
0Likes
Like

Posted 13 March 2013 - 04:19 PM

Yeah it was definitely a late-night what-am-I-missing.. error.


Chris LeJohn

Build Engineer (RE)
Gnovahex Computing


#8 Khatharr   Crossbones+   -  Reputation: 2963

Like
0Likes
Like

Posted 13 March 2013 - 05:39 PM

It's not that hard if you read the error message, which basically says a { isn't legal here, but you can use an = (or a ,; asm or __attribute__).

 

Yeah, that's why I was staring at that line. I think I was just sleep deprived. I was failing pretty hard at LoL last night too.


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS