forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[PSPSDK] I can't compile with SDL

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
PadPanic



Joined: 09 May 2006
Posts: 7

PostPosted: Thu Mar 08, 2007 3:05 am    Post subject: [PSPSDK] I can't compile with SDL Reply with quote

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
[quote]
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

Quote:
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:

#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]
Back to top
View user's profile Send private message
PadPanic



Joined: 09 May 2006
Posts: 7

PostPosted: Thu Mar 08, 2007 3:35 am    Post subject: Reply with quote

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:

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 :

Quote:

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
Back to top
View user's profile Send private message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Thu Mar 08, 2007 5:26 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group