paul_nicholls
Still Fresh
- Joined
- Nov 23, 2006
- Messages
- 42
Hi all,
I can make SDL programs using the SDL_Mixer for the gp2x using the devkitGP2X ok, but when I do the same thing using freepascal I get a crash.
So to try and get around this issue I am experimenting with trying to make a library? file (*.o) that I can link into the freepascal to see if this fixed the problem.
I have test c and h files I want to compile.
gp2x_sdl_mixer.h
CODE
#ifndef GP2X_SDL_MIXER
#define GP2X_SDL_MIXER
#include "SDL.h"
#include "SDL_mixer.h"
int Mix_gp2x_OpenAudio(int frequency, Uint16 format, int channels, int chunksize);
void Mix_gp2x_CloseAudio();
#endif
gp2x_sdl_mixer.c
CODE
#include "gp2x_sdl_mixer.h"
int Mix_gp2x_OpenAudio(int frequency, Uint16 format, int channels, int chunksize)
{
return Mix_OpenAudio(frequency,format,channels,chunksize);
};
void Mix_gp2x_CloseAudio()
{
Mix_CloseAudio();
};
I tried compiling it using
CODE
arm-linux-gcc.exe -c gp2x_sdl_mixer.c
but of course it complains that it can't find SDL.h for starters - fair enough.
So I have had a look at the sdltest makefile by (Guyfawks), but the problem is that I don't know much about Makefiles and I don't know how I could modify the makefile to compile my gp2x_sdl_mixer.c file to .o format.
Makefile
CODE
CROSS_COMPILE = C:/devkitGP2X/bin/arm-linux-
SDL_BASE = C:/devkitGP2X/bin/arm-linux-
LDFLAGS = -static
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
CXXFLAGS = -I"C:/devkitGP2X/include" -I"C:/devkitGP2X/include/SDL" -DTARGET_GP2X -O2 -Wall
LIBS = -L"C:/devkitGP2X/lib" -lSDL -lSDL_gfx --start-group -lSDL_ttf -lfreetype -lSDL --end-group -lSDL_image -ljpeg -lpng12 -lz --start-group -lSDL_mixer -lvorbisidec -lmikmod -lsmpeg -lSDL --end-group -lgcc -lm -lc -lexpat -lpthread -ldl
TARGET = sdltest.gpe
OBJS = sdltest.o
ALL_TARGETS = $(TARGET)
all: $(ALL_TARGETS)
$(TARGET): $(OBJS)
$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
$(STRIP) $(TARGET)
clean:
rm *.o
rm $(TARGET)
Any ideas or help would be great!
PS If it helps, I am compiling under windows and using the Make.exe found here (c:\devkitGP2X\minsys\bin)
cheers,
Paul
I can make SDL programs using the SDL_Mixer for the gp2x using the devkitGP2X ok, but when I do the same thing using freepascal I get a crash.
So to try and get around this issue I am experimenting with trying to make a library? file (*.o) that I can link into the freepascal to see if this fixed the problem.
I have test c and h files I want to compile.
gp2x_sdl_mixer.h
CODE
#ifndef GP2X_SDL_MIXER
#define GP2X_SDL_MIXER
#include "SDL.h"
#include "SDL_mixer.h"
int Mix_gp2x_OpenAudio(int frequency, Uint16 format, int channels, int chunksize);
void Mix_gp2x_CloseAudio();
#endif
gp2x_sdl_mixer.c
CODE
#include "gp2x_sdl_mixer.h"
int Mix_gp2x_OpenAudio(int frequency, Uint16 format, int channels, int chunksize)
{
return Mix_OpenAudio(frequency,format,channels,chunksize);
};
void Mix_gp2x_CloseAudio()
{
Mix_CloseAudio();
};
I tried compiling it using
CODE
arm-linux-gcc.exe -c gp2x_sdl_mixer.c
but of course it complains that it can't find SDL.h for starters - fair enough.
So I have had a look at the sdltest makefile by (Guyfawks), but the problem is that I don't know much about Makefiles and I don't know how I could modify the makefile to compile my gp2x_sdl_mixer.c file to .o format.
Makefile
CODE
CROSS_COMPILE = C:/devkitGP2X/bin/arm-linux-
SDL_BASE = C:/devkitGP2X/bin/arm-linux-
LDFLAGS = -static
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
CXXFLAGS = -I"C:/devkitGP2X/include" -I"C:/devkitGP2X/include/SDL" -DTARGET_GP2X -O2 -Wall
LIBS = -L"C:/devkitGP2X/lib" -lSDL -lSDL_gfx --start-group -lSDL_ttf -lfreetype -lSDL --end-group -lSDL_image -ljpeg -lpng12 -lz --start-group -lSDL_mixer -lvorbisidec -lmikmod -lsmpeg -lSDL --end-group -lgcc -lm -lc -lexpat -lpthread -ldl
TARGET = sdltest.gpe
OBJS = sdltest.o
ALL_TARGETS = $(TARGET)
all: $(ALL_TARGETS)
$(TARGET): $(OBJS)
$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
$(STRIP) $(TARGET)
clean:
rm *.o
rm $(TARGET)
Any ideas or help would be great!
PS If it helps, I am compiling under windows and using the Make.exe found here (c:\devkitGP2X\minsys\bin)
cheers,
Paul