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.

DS development > Compile error in new DevKitArm

#107491 - headspin - Mon Oct 30, 2006 5:08 am

I am compiling some old stuff of mine using the latest DKA and I keep getting this error:

Quote:
c:/devkitPro/source/DSGoo/source/goo.h:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CGoo'


The line it's referring to is "class CGoo" which is just a definition of a class called CGoo.

I never got this error before, so I'm not sure what can be causing it. I can't see anything wrong with the code either.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#107500 - OOPMan - Mon Oct 30, 2006 7:50 am

Are you sure it's compiling with the correct compiler? (G++ as oppossed to GCC)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#107515 - gmiller - Mon Oct 30, 2006 1:10 pm

As OOPMan says it appears that the compiler you are using does not understand the keyword "class". Check you file extensions, if they are .c then the gcc compiler will "assume" C code not C++. If you make them .cpp then the compiler will assume C++. This can be overridden with a command line switch but it tends to compilcate mixed projects.

I get this same error in C when I use a user defined type and forget to include the header that defines it.

#107525 - OOPMan - Mon Oct 30, 2006 3:11 pm

Yeah, basically I remember having this issue while porting MTCLib. It had issues trying to compile some of the C++ files with GCC...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#107556 - headspin - Mon Oct 30, 2006 9:14 pm

Yeah Goo.h contains the definition for the class, and Goo.cpp has all the methods. Is there something else I have to do in the header file to force it to recognise the class keyword?

Here is the make output
Quote:
C:\devkitPro\source\DSGoo>make
main.c
arm-eabi-gcc -MMD -MP -MF /c/devkitPro/source/DSGoo/build/main.d -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-fram
e-pointer -ffast-math -mthumb -mthumb-interwork -I/c/devkitPro/source/DSGoo/include -I/c/devkitPro/libnds/include -I/c/d
evkitPro/source/DSGoo/build -DARM9 -c /c/devkitPro/source/DSGoo/source/main.c -o main.o
In file included from c:/devkitPro/source/DSGoo/source/main.c:33:
c:/devkitPro/source/DSGoo/source/goo.h:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CGoo'
c:/devkitPro/source/DSGoo/source/main.c: In function 'main':
c:/devkitPro/source/DSGoo/source/main.c:194: error: 'CGoo' undeclared (first use in this function)
c:/devkitPro/source/DSGoo/source/main.c:194: error: (Each undeclared identifier is reported only once
c:/devkitPro/source/DSGoo/source/main.c:194: error: for each function it appears in.)
c:/devkitPro/source/DSGoo/source/main.c:194: error: expected ';' before 'm_Goo'
c:/devkitPro/source/DSGoo/source/main.c:196: error: 'm_Goo' undeclared (first use in this function)
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#107558 - Sausage Boy - Mon Oct 30, 2006 9:19 pm

You do realize that main.c is compiled in c mode, right? And since include really just includes the contents of goo.h at the top of your .c file, it will be compiled with the c compiler as well. Hilarity ensues. Rename main.c to main.cpp.
_________________
"no offense, but this is the gayest game ever"

#107559 - headspin - Mon Oct 30, 2006 9:22 pm

Doh! I'm an idiot thanks Sausage Boy, forgot to rename to main.cpp when pasting into the new template. Thanks :)
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#107560 - Sausage Boy - Mon Oct 30, 2006 9:24 pm

No problem. It's such an easy mistake to make. :D
_________________
"no offense, but this is the gayest game ever"

#107590 - OOPMan - Tue Oct 31, 2006 7:43 am

Templates: The Hidden Threat To Society As We Know It...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...