When I first tried compliling a small program using SDL_image I used the
following line to compile and got the following error…
g++ fosdl8_1.cpp -o fosdl sdl-config --cflags --libs
/tmp/ccCum2vK.o(.text+0x8f): In function main': : undefined reference to
IMG_Load’
collect2: ld returned 1 exit status
So then I went and tried the following compile line…
g++ fosdl8_1.cpp -o fosdl sdl-config --cflags --libs
-lSDL_image
…and I received a list of errors containing things like…
/usr/lib/libSDL_image.a(IMG_jpg.o)(.text+0x40b): In function
IMG_LoadJPG_RW': : undefined reference to
jpeg_destroy_decompress’
/usr/lib/libSDL_image.a(IMG_png.o)(.text+0x4a): In function IMG_isPNG': : undefined reference to
png_sig_cmp’
/usr/lib/libSDL_image.a(IMG_png.o)(.text+0x6d): In function png_read_data': : undefined reference to
png_get_io_ptr’
/usr/lib/libSDL_image.a(IMG_png.o)(.text+0xe7): In function IMG_LoadPNG_RW': : undefined reference to
png_create_read_struct’
/usr/lib/libSDL_image.a(IMG_png.o)(.text+0xfa): In function IMG_LoadPNG_RW': : undefined reference to
png_create_info_struct’
…all of the errors pertained to 'IMG_LoadJPG_RWand
IMG_LoadPNG_RW`.
Anyone come across this before or have any ideas on how to fix this? The
latest version of SDL_image is installed.
thanks!
Art-
Arthur Dodd wrote
g++ fosdl8_1.cpp -o fosdl sdl-config --cflags --libs
-lSDL_image
…and I received a list of errors containing things like…
/usr/lib/libSDL_image.a(IMG_jpg.o)(.text+0x40b): In function
IMG_LoadJPG_RW': : undefined reference to
jpeg_destroy_decompress’
/usr/lib/libSDL_image.a(IMG_png.o)(.text+0x4a): In function IMG_isPNG': : undefined reference to
png_sig_cmp’
/usr/lib/libSDL_image.a(IMG_png.o)(.text+0x6d): In function
png_read_data': : undefined reference to
png_get_io_ptr’
which implies that it is not finding the jpeg and ping libs .
Cant remember whether DevIL takes care of the png and jpeg stuff
or whether you need the libpng and libjpeg stuff …
try -lIL (if you have devil installed (and I am fairly certain
that it is a requirement of sdl image)).
and if that doesnt do it add -lpng and -ljpeg .
Hope you fix it soon,
Steve Houseman–
currently : | for strace, an annotator see -
@steve_houseman | http://www.houseman.demon.co.uk/
Adding those two library flags fixed the problem. I knew I had those bad
boys installed :).
thanks!
Art-> Arthur Dodd wrote
> g++ fosdl8_1.cpp -o fosdl `sdl-config --cflags --libs` -lSDL_image
>
> ...and I received a list of errors containing things like...
>
>
> /usr/lib/libSDL_image.a(IMG_jpg.o)(.text+0x40b): In function
> `IMG_LoadJPG_RW':
> : undefined reference to `jpeg_destroy_decompress'
> /usr/lib/libSDL_image.a(IMG_png.o)(.text+0x4a): In function `IMG_isPNG':
> : undefined reference to `png_sig_cmp'
> /usr/lib/libSDL_image.a(IMG_png.o)(.text+0x6d): In function
`png_read_data':
> : undefined reference to `png_get_io_ptr'
which implies that it is not finding the jpeg and ping libs .
Cant remember whether DevIL takes care of the png and jpeg stuff
or whether you need the libpng and libjpeg stuff …
try -lIL (if you have devil installed (and I am fairly certain
that it is a requirement of sdl image)).
and if that doesnt do it add -lpng and -ljpeg .
Hope you fix it soon,
Steve Houseman
–
currently : | for strace, an annotator see -
steve at houseman demon co uk | http://www.houseman.demon.co.uk/
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl