Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3B8D3110.9090908@ece.gatech.edu> Date: Wed, 29 Aug 2001 14:14:40 -0400 From: "Charles S. Wilson" User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1 X-Accept-Language: en-us MIME-Version: 1.0 To: aliaga AT research DOT bell-labs DOT com CC: cygwin AT cygwin DOT com Subject: Re: CYGWIN JPEG question References: <000901c1309e$d43e6730$a8256887 AT research DOT belllabs DOT com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Daniel G. Aliaga wrote: > I recently installed CYGWIN. Its great! > > I'm porting code that uses the standard JPEG library. I specify the library > on the link line, but I get error messages such as the following (one for > every jpeg call): > > ....: undefined reference to 'import stub for > jpeg_read_header(jpeg_decompress_struct *, int)' Did you "interpret" this error message? I've never seen gcc/ld spell stuff out in that much detail. Ordinarily, the error would be "undefined reference to __imp__jpeg_read_header" in this case. > and so forth, etc. > > > I suppose this has something to do with DLLs vs libraries. It seems > libjpeg.a and libjpeg.dll.a are already in /usr/lib. I suppose the > installation properly created them. cjpeg and djpeg work just fine. Yes, static lib, import lib, and DLL are all included in the dist. > Is there something special I need to do during link time? I come from a Unix > background. My compile line is something simple like: > > "g++ -o myprogram myprogram.C -ljpeg -lm" > First, you should probably split compilation and linking into two separate steps (not *really* necessary, but often illuminating). Second, you need to decide whether you want to link statically or dynamically. Static: add -DJPEG_STATIC (or -DALL_STATIC) when compiling add -static when linking (this will cause the linker to hunt for "libjpeg.a" instead of "libjpeg.dll.a" when given "-ljpeg". Dynamic: Strange -- what you have should work (minus the -lm, but that shouldn't affect anything). The system header files are set up to define/declare things appropriately for a dynamic link. Please try: g++ -c -o myprogram.o myprogram.C g++ -o myprogram myprogram.o -ljpeg (BTW, I'm not sure that the jpeg library is C++ safe...) --Chuck P.S. personal mail makes me LESS likely to respond, not more. I get five or more messages a day of cygwin-related personal mail that belongs on the list. Most of it goes in the trash. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/