[PSPSDK] I can't compile with SDL

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
PadPanic
Posts: 7
Joined: Tue May 09, 2006 9:23 pm

[PSPSDK] I can't compile with SDL

Post by PadPanic »

Hi,


I Have XUBUNTU on a vitual machine, i install PSPSDK and PSPSDL libraries,
compilation for PSP work but my problem is when i compile for linux.
GCC can't find SDL and other SDL libs.

The SDL Dev libraries is installed with
sudo apt-get install libsdl1.2debian-all

sudo apt-get install libsdl1.2-dev

sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev


when i compile with:

gcc main.c -lSDLmain -lSDL -lSDL_image

i have
error: ‘SDL_WM_SetCaption’ was not declared in this scope
main.c:21: error: ‘SDL_MapRGB’ was not declared in this scope
.......
main.c:29: error: ‘SDL_Quit’ was not declared in this scope

main.c

Code: Select all

#include "SDL.h"
#include "SDL_image.h"

int main( int argc, char* argv[])
{

SDL_Init(SDL_INIT_VIDEO);

SDL_Surface *screen = NULL, *image = NULL;
SDL_Rect position;

image = IMG_Load("image.jpg");

position.x = 0;

position.y = 0;

screen = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("Test tout simple", NULL);

SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255,255,255) );

SDL_BlitSurface( image, NULL, screen, &position );

SDL_Flip(screen);
SDL_Delay(3000);
SDL_FreeSurface(image);
SDL_Quit();
}
thanks[/code]
PadPanic
Posts: 7
Joined: Tue May 09, 2006 9:23 pm

Post by PadPanic »

I solved that error with

#include "SDL/SDL.H"
#include "SDL/SDL_image.h"

the compilation is ok

but when i compile the same program for PSP with that Makefile:

Code: Select all

PCCC     = gcc
PCCFLAGS = -O2 -g -Wall -DDEBUG -DNOTPSP
PCLIBS   = -L/usr/lib
PCINCLUDE = -I/usr/include -I/usr/include/SDL
OBJS = main.o 

TARGET = alpha

CFLAGS = -O2 -g -Wall -DDEBUG
LIBS=
LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP kxploit
EXTRA_CLEAN = pcclean

# --- PC SDL
PCCFLAGS += $(shell sdl-config --cflags)
PCLIBS += $(shell sdl-config --libs)
PCLIBS += -lSDL_mixer -lm -lSDL -lSDLmain -lSDL_image -lpng -lz

PSP_EBOOT_TITLE = TEST
PSP_DIR_NAME = TEST

PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += $(shell $(PSPBIN)/sdl-config --libs)
LIBS += -lm -lSDL -lSDLmain -lSDL_image -lpng -lz -ljpeg
include $(PSPSDK)/lib/build.mak

I have that errors :
alpha@alpha-desktop:~/Desktop/PROjectS/d$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -g -Wall -DDEBUG -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -D_PSP_FW_VERSION=150 -L. -L/usr/local/pspdev/psp/sdk/lib main.o -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lm -lSDL -lSDLmain -lSDL_image -lpng -lz -ljpeg -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o alpha.elf
/usr/local/pspdev/psp/lib/libSDL_image.a(IMG.o): In function `IMG_Load':
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG.c:65: undefined reference to `SDL_RWFromFile'
/usr/local/pspdev/psp/lib/libSDL_image.a(IMG_bmp.o): In function `IMG_LoadBMP_RW':
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:196: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:197: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:198: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:199: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:202: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:215: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:216: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:217: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:218: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:219: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:220: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:221: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:222: undefined reference to `SDL_ReadLE32'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:223: undefined reference to `SDL_ReadLE32'
/usr/local/pspdev/psp/lib/libSDL_image.a(IMG_bmp.o):/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:224: more undefined references to `SDL_ReadLE32' follow
/usr/local/pspdev/psp/lib/libSDL_image.a(IMG_bmp.o): In function `IMG_LoadBMP_RW':
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:204: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:205: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:206: undefined reference to `SDL_ReadLE16'
/home/alpha/Desktop/PROjectS/badbilly/bad_billy/SDL_image/IMG_bmp.c:207: undefined reference to `SDL_ReadLE16'
/usr/local/pspdev/psp/lib/libpng.a(pngrtran.o): In function `png_build_gamma_table':
pngrtran.c:(.text+0x1258): undefined reference to `pow'
pngrtran.c:(.text+0x1470): undefined reference to `pow'
pngrtran.c:(.text+0x1518): undefined reference to `pow'
pngrtran.c:(.text+0x1630): undefined reference to `pow'
pngrtran.c:(.text+0x170c): undefined reference to `pow'
/usr/local/pspdev/psp/lib/libpng.a(pngrtran.o):pngrtran.c:(.text+0x17f8): more undefined references to `pow' follow
collect2: ld returned 1 exit status
make: *** [alpha.elf] Error 1
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

To compile SDL programs for PSP you need to install the psp version of SDL:

You need to get the packages from the ps2dev svn, then read the README.PSP contained in each to see how to install it.
The packages you will need (Based on your makefile) in the order you should install them are:
zlib, libpng, SDL, SDL_image, SDL_mixer

To get them:

svn co svn://svn.ps2dev.org/psp/trunk/[PACKAGE NAME]

Then check the new folder for the README.PSP and follow the instructions to install it.
Post Reply