gsLib and libjpg

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
sincro
Posts: 25
Joined: Tue Jan 27, 2004 9:54 am

gsLib and libjpg

Post by sincro »

Hi to all, i need help :)

i'm working on tool in gslib and i need to use libjpg but i have problem with make file:

Code: Select all

EE_BIN = jpg.elf
EE_OBJS = jpg.o

EE_LIBS += -lgcc -lgs -ljpg -lc -lkernel -lc -lsyscall -ldebug -lsyscall -lkernel


EE_INCS += -I$ ./INC
EE_LDFLAGS += -L$ ./LIB

all: $(EE_BIN)

clean:
	del *.elf *.o *.a


include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal
in subdir LIB i have put libgslib.a and libjpg.a
in subdir INC i have put all needed file include by two lib

when i compile:

Code: Select all

ee-g++ -D_EE -O2 -G0 -Wall  -IC:\PS2Dev\COMPILER\LIB\PS2SDK/ee/include -IC:\PS2D
ev\COMPILER\LIB\PS2SDK/common/include -I. -I./INC -c jpg.cpp -o jpg.o
ee-gcc -mno-crt0 -TC:\PS2Dev\COMPILER\LIB\PS2SDK/ee/startup/linkfile -LC:\PS2Dev
\COMPILER\LIB\PS2SDK/ee/lib -L./LIB \
                -o jpg.elf C:\PS2Dev\COMPILER\LIB\PS2SDK/ee/startup/crt0.o jpg.o
 -lgcc -lgs -ljpg -lc -lkernel -lc -lsyscall -ldebug -lsyscall -lkernel -lc -lke
rnel
jpg.o: In function `displayjpeg(jpgData*)':
jpg.o(.text+0x84): undefined reference to `jpgReadImage(jpgData*, unsigned char*
)'
jpg.o(.text+0x94): undefined reference to `jpgClose(jpgData*)'
jpg.o: In function `main':
jpg.o(.text+0x218): undefined reference to `jpgOpen(char*)'
jpg.o(.data+0x15): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [jpg.elf] Error 1
how to solve this problem?

the main jpg.cpp have include libjpg.h

help please

sincro
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Are you sure it isn't 'libjpeg.a' instead of 'libjpg.a'?

If so, you'd need a '-ljpeg'.
sincro
Posts: 25
Joined: Tue Jan 27, 2004 9:54 am

Post by sincro »

yes i'm sure

is libjpg Ported by linuzappz on cvs root, not libjpeg from ps2sdk-ports

if you want i post link with my test sourcecode

EDIT: you can download my test source code here
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

<emoonwork> you need -lstdc++ to get rid of __gxx stuff atleast
<sincro> i try emoonwork
<emoonwork> ooPo: maybe no extern "C" {...} in the header for the C functions?
<ooPo> hmm, that's quite possible
<sincro> <emoonwork> with -lstdc++ i solve __gxx stuff problem
<ooPo> yup, no extern in the header
<sincro> but other undefined reference have problem
<sincro> i have past source code link on forum
<ooPo> http://cvs.ps2dev.org/libjpg/libjpg/inc ... .h?rev=1.3
<emoonwork> ok, no extern "C"
<ooPo> just put some around where it is included in his code
<emoonwork> yeah
<sincro> ?
<sincro> extern c in source?
<sincro> ok i try

Code: Select all

#ifdef __cplusplus
extern "C" &#123;
#endif

#include <libjpg.h>

#ifdef __cplusplus
&#125;
#endif
<sincro> YEAH compiler work
<sincro> tnx tnx tnx
<sincro> :)
sincro
Posts: 25
Joined: Tue Jan 27, 2004 9:54 am

** PROBLEM SOLVED **

Post by sincro »

Ok, now all work

Thanks to ooPo and emoonwork for help

you can download source code of test HERE
Post Reply