Oh yes,
I redefined the GLOBAL and EXTERN macro in the jpeg headers to assume static linking to the library by default:

/* a function referenced thru EXTERNs: */


GLOBAL(type) type

/* a reference to a GLOBAL function: */


EXTERN(type) type
I hope this solution is not wrong at the head of it. Is it?

On Tue, May 20, 2008 at 4:35 PM, Brian Dessent <brian@dessent.net> wrote:
Novice Programmer wrote:

> cjpeg.o:cjpeg.c:(.text+0xd53): undefined reference to
> `_imp__jpeg_destroy_compress'
> i configured using ./configure --enable-static. and made it using
> command make. Any pointers would be helpful.

When you see an undefined reference to "_imp__something" that means the
call site was calling a function that was declared dllimport but you're
trying to link with a static version of the library.  The library's
headers in this case were obviously designed to assume dynamic as the
default and require special action to use the static version, so
providing only the static library causes the error.

There are two solutions: link with the dynamic (DLL) version of the
library (i.e. link with the import lib) or tell the headers to not
declare the functions as dllimport.  Usually this is done by defining
something such as "-DLIBJPEG_STATIC"; you'd have to check the headers to
see the exact wording.


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
MinGW-users mailing list

You may change your MinGW Account Options or unsubscribe at:

Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).