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 

libjpeg problems

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



Joined: 13 Jul 2009
Posts: 5

PostPosted: Fri Jul 24, 2009 10:02 am    Post subject: libjpeg problems Reply with quote

Hello, I was trying to load a JPEG image with libjpeg, the code compiles but the linker returns errors indicating that the functions were not found.

main.cpp:
Code:

#include <pspkernel.h>
#include <stdio.h>
#include <stdlib.h>
#include <jpeglib.h>

int load_jpeg_file(FILE* f)
{
   if(!f)
      return 0;
   jpeg_error_mgr jerr;
   struct jpeg_decompress_struct cInfo;
   cInfo.err = jpeg_std_error(&jerr);
   jpeg_create_decompress(&cInfo);
   jpeg_stdio_src(&cInfo, f);
   return 1;
}
/* Define the module info section */
PSP_MODULE_INFO("Test", 0, 0, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);

int main(int argc, char* argv[])
{
   return 0;
}


linker:
Code:

psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -L/usr/local/pspdev/psp/sdk/lib -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx   main.o /usr/local/pspdev/psp/sdk/lib/prxexports.o -lglut -lglu -lgl -lg -lpspvfpu -lpsprtc -lpsprtc_driver -lpspjpeg -ljpeg -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o test.elf
main.o: In function `load_jpeg_file(__sFILE*)':
main.cpp:(.text+0x2c): undefined reference to `jpeg_std_error(jpeg_error_mgr*)'
main.cpp:(.text+0x40): undefined reference to `jpeg_CreateDecompress(jpeg_decompress_struct*, int, unsigned int)'
main.cpp:(.text+0x4c): undefined reference to `jpeg_stdio_src(jpeg_decompress_struct*, __sFILE*)'
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1


Whats the reason? I'm getting crazy with this error ...

Thanks.
Back to top
View user's profile Send private message
psPea



Joined: 01 Sep 2007
Posts: 64

PostPosted: Fri Jul 24, 2009 10:33 am    Post subject: Reply with quote

libjpeg is C
extern "C" anyone
_________________
Click ME!
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Fri Jul 24, 2009 6:18 pm    Post subject: Reply with quote

psPea wrote:
libjpeg is C
extern "C" anyone


Shouldn't that be in jpeglib.h???

(It isn't in there. I know)
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jul 25, 2009 1:17 am    Post subject: Reply with quote

jojojoris wrote:
psPea wrote:
libjpeg is C
extern "C" anyone


Shouldn't that be in jpeglib.h???

(It isn't in there. I know)


If you change a .c to .cpp, you need to put extern "C" {} around the C functions in that file as well.
Back to top
View user's profile Send private message AIM Address
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