Newbie Devcpp Compiler Errors.. What A Basic Mistake To Make...


Arch Deviant

Still Fresh
Joined
Dec 14, 2006
Messages
12
Location
Colchester
Website
Visit site
Hi,

following the wiki on http://wiki.gp2x.org/wiki/Using_Devcpp I end up with the following compiler errors.
I managed to make the gpe outside of the devcpp environment but inside devcpp its a no go :( can anyone help? sorry for such a lame first question but never coded in c/c++ before and all this library stuff takes some getting used to..

would I be better going for something like pygame to get up to speed on the gp2x before trying C?

thanks in advance


Compiler Log:
Compiler: devkitgp2x
Building Makefile: "C:\code\Makefile.win"
Executing make...
make.exe -f "C:\code\Makefile.win" all
arm-linux-g++.exe sdltest.o -o "Project1.gpe" -L"C:/devkitgp2x/lib" -static -lSDL_mixer -lSDL_ttf -lSDL_image -lsmpeg -lmikmod -lvorbisidec -lfreetype -ljpeg -lpng12 -lz -lm -lSDL -lpthread

sdltest.o: In function `TestSDLImage()':
sdltest.cpp:(.text+0x6a8): undefined reference to `rotozoomSurfaceXY'
C:/devkitgp2x/lib\libSDL_mixer.a(mp3_mad.o): In function `mad_openFileRW':
mp3_mad.c:(.text+0x1c): undefined reference to `mad_stream_init'
mp3_mad.c:(.text+0x24): undefined reference to `mad_frame_init'

mp3_mad.c:(.text+0x30): undefined reference to `mad_synth_init'
mp3_mad.c:(.text+0xa0): undefined reference to `mad_timer_zero'
C:/devkitgp2x/lib\libSDL_mixer.a(mp3_mad.o): In function `mad_closeFile':
mp3_mad.c:(.text+0xc4): undefined reference to `mad_stream_finish'
mp3_mad.c:(.text+0xcc): undefined reference to `mad_frame_finish'
C:/devkitgp2x/lib\libSDL_mixer.a(mp3_mad.o): In function `read_next_frame':
mp3_mad.c:(.text+0x150): undefined reference to `mad_frame_decode'
mp3_mad.c:(.text+0x17c): undefined reference to `mad_stream_errorstr'
mp3_mad.c:(.text+0x24c): undefined reference to `mad_stream_buffer'
mp3_mad.c:(.text+0x260): undefined reference to `mad_frame_decode'
mp3_mad.c:(.text+0x28c): undefined reference to `mad_timer_add'
mp3_mad.c:(.text+0x2f8): undefined reference to `mad_stream_buffer'
C:/devkitgp2x/lib\libSDL_mixer.a(mp3_mad.o): In function `mad_seek':
mp3_mad.c:(.text+0x384): undefined reference to `mad_timer_set'
mp3_mad.c:(.text+0x390): undefined reference to `mad_timer_compare'
mp3_mad.c:(.text+0x3f4): undefined reference to `mad_timer_compare'
mp3_mad.c:(.text+0x444): undefined reference to `mad_timer_zero'
C:/devkitgp2x/lib\libSDL_mixer.a(mp3_mad.o): In function `mad_getSamples':
mp3_mad.c:(.text+0x5a8): undefined reference to `mad_synth_frame'
C:/devkitgp2x/lib\libSDL_mixer.a(mp3_mad.o): In function `mad_openFile':
mp3_mad.c:(.text+0x820): undefined reference to `mad_stream_init'
mp3_mad.c:(.text+0x828): undefined reference to `mad_frame_init'
mp3_mad.c:(.text+0x834): undefined reference to `mad_synth_init'
mp3_mad.c:(.text+0x8a8): undefined reference to `mad_timer_zero'

make.exe: *** [Project1.gpe] Error 1

Execution terminated
 
fireflly2442 posted on Dec 29 2006 at 02:17 AM said:
Hi. I was just working on trying to get DevCPP installed and I'm a newbie but I think you might be using a different version of SDL than the program you are trying to compile. Maybe try something simple like this...

http://wiki.gp2x.org/wiki/Writing_an_SDL_Hello_World

Thanks fireflly, I am using the SDL from guyfawkes in his gp2x user guide. (Dev env B see link below)

I think its something I am doing wrong in the devcpp environment, because nothing seems to compile where as when I went through the cmd prompt and typed make its was ok...

Think I better start from scratch (again!) which of the dev environment set ups did you use? (assuming windows here)

Dev environments on wiki

I have tried A and B but no real joy in getting started in either. I know if I cant get the dev environment set up right I wont get anywhere.

thanks for your help
 
Last edited by a moderator:
I got the MinSYS up without too much effort following the directions. But then, I think you'd have to configure each makefile so that it had all the right information for paths to the devkit. Dunno, sorry I'm fairly new at this and still learning as well. Maybe hit up the IRC channel?
 
I'm surprised you have this problem with Dev-Cpp, but you'll need to add '-lmad' to the linker. If you are compiling in MSys, you'll need to add '-lmad' to the makefile.
 
I've just setup the same environment and have got the exact same problem. Adding -lmad to the linker fixes the MAD problems, but I'm now left with the following error:

I:\My Documents\Work\gp2xtest\sdltest.o In function `TestSDLImage()':
[Linker error] undefined reference to `rotozoomSurfaceXY'
I:\My Documents\Work\gp2xtest\Makefile.win [Build Error] [gp2xtest.gpe] Error 1

rotozoomSurfaceXY is missing as a function in the header file, could this be why? Or is this an SDL function? By commenting out this part of the test, the program compiles fine (as expected)

Any idea's anyone?

Previous Edit: (I should really pay attention to what I'm doing!)
 
I think rotozoomSurfaceXY is an SDL function sitting in \devkitgp2x\include\SDL\SDL_Rotozoom.h which is one of the SDL_gfx libraries

Like MattPurland if I comment out this line in guyfawkes code then I can get it to compile:

rotosprite = rotozoomSurfaceXY (sprite, 90.0, 2.0, 2.0, 1);

If you add in -lSDL_gfx into the linker parameters it compiles, but I have no idea why or what all these linker parameters are actually doing (found a similar problem on another forum).

check the typing its lower case L not I, lower case L looks identical to capital I in Dev-CPP. To make sure I retyped all my linker parameters, so cut and paste the following and it should work

-lSDLmain -lSDL -static -lSDL_mixer -lSDL_ttf -lSDL_image -lsmpeg -lmikmod -lvorbisidec -lfreetype -ljpeg -lpng12 -lz -lm -lSDL -lpthread -lmad -lSDL_gfx

I also have to explicitly state the path of the SDL libraries I am including, e.g.
#include "c:\devkitgp2x\include\SDL\SDL.h" rather than just #include "SDL.h"

no idea why, because c:\devkitgp2x\include\SDL\ is in the path but guess it is good practice anyhow to be explicit.
 
With the SDL lib's, including SDL/SDL.h works fine, no need to include the whole path. It seems adding -SLD_gfx to the linker fixes all problems... excellent!
 
Back
Top