PDA

View Full Version : It worked last night... Jpeglib + MinGW



147-2
02-25-2004, 07:40 AM
I know this may be considered by some "unrelated" but I have this little problem. I am running on the DevC++ compiler now, and yesterday I finally tracked down the libJPEG release that actually works with it. I compiled, and my engine ran beautifully. So I commit this whole mess to the CVS, and then move to my laptop. I update it there, worked out a single problem, and it now runs on my laptop.

I move back to my PC, and update that. Now I get the following linker errors, and what's worse, undoing what I did on the laptop doesn't fix them...

[Linker error] undefined reference to `_imp___Z16jpeg_read_headerP22jpeg_decompress_stru cti'


[Linker error] undefined reference to `_imp___Z21jpeg_start_decompressP22jpeg_decompress _struct'

... basically all the jpeg library calls I used. When I nm the libjpeg, I get the appropriate functions...


d000075.o:
00000000 i .idata$4
00000000 i .idata$5
00000000 i .idata$6
00000000 i .idata$7
00000000 t .text
U __head_libjpeg_6_dll
00000000 I __imp__jpeg_read_header
00000000 I __nm__jpeg_read_header
00000000 T _jpeg_read_header

... and so forth.

I notice that the function in the lib is

__imp__jpeg_read_header

but the function the linker is asking for is

`_imp___Z16jpeg_read_headerP22jpeg_decompress_stru cti...

(the linker didn't type a long enough error message)

and I think this is the source of the problem. The killer is, it all worked last night. Anyways, anybody have a fix for this prob?

Thx in adv
Rob

[This message has been edited by 147-2 (edited 02-25-2004).]

minimoog
02-25-2004, 02:06 PM
Somewhere is missing

extern "C".

or

#ifdef __cplusplus
extern "C" {
#endif

........

#ifdef __cplusplus
}
#endif

Check the headers.

Compiler thinks that is C++ function, that's why he decorates the function name.

147-2
02-25-2004, 02:32 PM
I think since it worked last night and doesn't now, with no source code changes... How odd. Anyways, I compile as I write this... so lets see how we're cooking... Ah, completed with a happy linker. Thankx for the suggestion, I wouldn't have tried that for a while...