Acmlm's Board - I2 Archive - Programming - Expected Declaration Before '}' Token
User | Post |
beneficii
Posts: 148/567 |
Originally posted by HyperHacker Don't you love when they do that? I had errors regarding a missing semicolon, which wasn't missing, because a bracket was in the wrong place in a completely different file. And don't even think about leaving out the semicolon at the end of function prototype declarations...
LOL, yeah. Needless to say, I have had this sort of problem before. |
HyperLamer
Posts: 5086/8210 |
Don't you love when they do that? I had errors regarding a missing semicolon, which wasn't missing, because a bracket was in the wrong place in a completely different file. And don't even think about leaving out the semicolon at the end of function prototype declarations... |
beneficii
Posts: 147/567 |
Here is a class:
class basic { public: basic() {;} ~basic() {;} int load(int curwold); int save(); int *getworld(void) {return &world;} int *getpalettenum(void) {return &palettenum;} int *getmap_tiles(void) {return map_tiles;} int *getanimrate(void) {return animationrate;} int *get1stmusic(void) {return &firstmusic;} int *get2ndmusic(void) {return &duringmusic;} int *getsize(void) {return &size;} private: int palettenum; int map_tiles[0x240]; int size; int world; int animationrate[4]; int firstmusic; int duringmusic; };
For the line, int *getmap_tiles(void) {return map_tiles;}
My compiler (gcc) for some reason keeps giving me the error of:
"expected declaration before '}' token"
Basically, this is stumping me. As you can see, I declared map_tiles already, as an array under the private level. Basically, all that is meant with the function int *basic::getmap_tiles(void) is to return the pointer to map_tiles. When I comment out getmap_tiles(void) (and the other functions that access it), there is no error. int *basic::getanimrate(void), which is very similar, does not return an error at all.
EDIT: Never mind. It was something unrelated, but for some reason instead of telling me the real problem, it simply kept fooling with me with that. |
|