JPGAlleg not working--link errors
Matt Sarnoff

I just compiled the JPGAlleg library, version 2.1, and everything went well, but when I try to incorporate it into a program, I get all these linker errors:

C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x1126):encode.c: undefined reference to `_imp___rgb_r_shift_32'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x1137):encode.c: undefined reference to `_imp___rgb_g_shift_32'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x1147):encode.c: undefined reference to `_imp___rgb_b_shift_32'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x11e5):encode.c: undefined reference to `_imp___rgb_r_shift_32'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x11f8):encode.c: undefined reference to `_imp___rgb_g_shift_32'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x1208):encode.c: undefined reference to `_imp___rgb_b_shift_32'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x12de):encode.c: undefined reference to `_imp__cpu_capabilities'
C:\DEV-CPP\lib/libjpgal.a(encode.o)(.text+0x12e8):encode.c: undefined reference to `_imp___rgb_r_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x12d4):decode.c: undefined reference to `_imp___rgb_r_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x12df):decode.c: undefined reference to `_imp___rgb_g_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x12f0):decode.c: undefined reference to `_imp___rgb_b_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x13b1):decode.c: undefined reference to `_imp___rgb_r_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x13bc):decode.c: undefined reference to `_imp___rgb_g_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x13cd):decode.c: undefined reference to `_imp___rgb_b_shift_32'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x17ae):decode.c: undefined reference to `_imp__cpu_capabilities'
C:\DEV-CPP\lib/libjpgal.a(decode.o)(.text+0x17b8):decode.c: undefined reference to `_imp___rgb_r_shift_32'

All these errors, and all I did was use the jpgalleg_init() function. I'm compiling a static-linked program with Dev-C++. The DUMB mod-playing library is also being linked with it as well (my program has music too). I'm compiling the program with these linker options:
-laldmd -ldumbd -lalleg_s -lgdi32 -ldxguid -lole32 -ldinput -lddraw -lwinmm -ldsound -ljpgal

I hate linker errors...
-matt

Bob

Try using:

-ljpgal -laldmd -ldumbd -lalleg_s -lgdi32 -ldxguid -lole32 -ldinput -lddraw -lwinmm -ldsound


instead. The link order matters.

lillo

Bob is right. From JPGalleg readme.txt file, FAQ section:

Quote:

Q) I get a "undefined reference to: 'register_datafile_object'" message when
linking my program, while the examples shipped with the library compiled
nicely. What's wrong?

A) Try swapping the order with which you link Allegro and JPGalleg to your
program. This should solve the problem.

Ok, you don't get the error on that particular function, but you should have got the point.

Matt Sarnoff

I compiled the program as an alleg40.dll-dependent version, and put -lpgal first, and it works perfectly. Thanks.

Hey Angelo...back in my QBasic days, I used to make sound effects for my games with your Soundlab program--it was awesome.

Oh yeah...and Wetspot rocks!

-matt

lillo

heh, thanks :)

note to self: should really finish new Wetspot some day...

Thread #280648. Printed from Allegro.cc