| View previous topic :: View next topic |
| Author |
Message |
yargon
Joined: 13 Jul 2009 Posts: 5
|
Posted: Fri Jul 24, 2009 10:02 am Post subject: libjpeg problems |
|
|
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 |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Fri Jul 24, 2009 10:33 am Post subject: |
|
|
libjpeg is C
extern "C" anyone _________________ Click ME! |
|
| Back to top |
|
 |
jojojoris
Joined: 30 Mar 2008 Posts: 261
|
Posted: Fri Jul 24, 2009 6:18 pm Post subject: |
|
|
| 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 |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat Jul 25, 2009 1:17 am Post subject: |
|
|
| 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 |
|
 |
|