|
expected primary-expression before "static" |
Glaeder
Member #8,930
August 2007
|
is use Dev-c++ with allegro, und it gives me the error
Quote: expected primary-expression before "static" when i try to comile the programm.
//fps-counter int maxSkip = 4; volatile int timerCounter = 0; static void timerCounterUpdater() { timerCounter++; } END_OF_STATIC_FUNCTION(timerCounterUpdater); LOCK_FUNCTION(timerCounterUpdater); LOCK_VARIABLE(timerCounter); can you help me? i don't now what the programm means by this error, is it a syntax error??? |
ReyBrujo
Moderator
January 2001
|
Can you remove all the code and leave only the minimum necessary for the error to be triggered, then post it here? Maybe you forgot to put a } or ; somewhere above. Which is the exact line triggering the error? -- |
Glaeder
Member #8,930
August 2007
|
that's the line where the compiler finds the error: static void timerCounterUpdater() it's an example from an learning-book, i can post the complete code (it isn't extremly much) if you want... edit: that is the whole "function" or how i should call it: static void timerCounterUpdater() { timerCounter++; }
|
ReyBrujo
Moderator
January 2001
|
Post it all, from what I see, the function is not the problem. -- |
Goodbytes
Member #448
June 2000
|
You must post the complete code. |
Glaeder
Member #8,930
August 2007
|
yees, it's maybe not the cleanest code but it should work... the example in the book isn't very good explained. as you maybe see, it should be a fps-limiter-thing... i would like to use 60fps, if anyone knows a better solution for that problem the other thing like sound, graphics etc works fine without the fps-part. PS: don't care about the german comments |
Goodbytes
Member #448
June 2000
|
You can't declare a function inside another. Move the declaration of timerCounter and timerCounterUpdater outside main() (but keep the LOCK_* macros where they are). If ReyBrujo posts this at the same time I do, I apologize for repeating |
ReyBrujo
Moderator
January 2001
|
Move int maxSkip = 4; volatile int timerCounter = 0; static void timerCounterUpdater() { timerCounter++; } END_OF_STATIC_FUNCTION(timerCounterUpdater); above the main function (those lines should not be inside the main function, but outside it). (Edit: Apologies for repeating! ) -- |
Glaeder
Member #8,930
August 2007
|
thank you! that fixed the problem
but now theres an error on this line: error: Quote: `needsRefresh' undeclared (first use this function)
whats wrong now? the same thing like above? wehn yes, i don't now where i should move this part |
ReyBrujo
Moderator
January 2001
|
You don't have it defined anywhere. In the main function, where you define the variables, add int needsRefresh = FALSE;, that should fix it. -- |
|