Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Henrik Bengtsson" To: Subject: RE: gcc and libtiff, maybe a newbie question Date: Fri, 3 Jan 2003 17:59:38 +1100 Message-ID: <000601c2b2f5$aeb515b0$7341a8c0@alpha.wehi.edu.au> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <20030103065248.10FE53A86@sitemail.everyone.net> Vola, it works for me now. Thanks a lot and have really good day! Henrik > -----Original Message----- > From: cygwin-owner AT cygwin DOT com > [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Elfyn McBratney > Sent: den 3 januari 2003 17:53 > To: Henrik Bengtsson; cygwin AT cygwin DOT com > Subject: Re: gcc and libtiff, maybe a newbie question > > > Hi, > > The problem is partially due to where the -lname bits are. > They should be put at the end of the line (after all options > and stuff). You also needed to include libz (-lz) and libjpeg > (-ljpeg). > > This worked for me: > > $ gcc -static -o tifft tifft.c -lm -ltiff -ljpeg -lz > > P.s. I renamed your file to tifft.c, still using your code. > > Elfyn > elfyn AT exposure DOT org DOT uk > > > --- "Henrik Bengtsson" wrote: > >Hi, first I haven't done C programming in years and am a bit > rusty with > >gcc and ld. I am having problems with ld reporting > "undefined reference > >to _TIFFOpen" etc, which should be in libtiff. However, I am > not even > >sure if the problem is about libtiff or if miss something else. > > > >Here is my minimize code I am trying to compile and link (write.c): > > > >#include > >#include "tiff.h" > >#include "tiffio.h" > > > >int main(int argc, char *argv[]) { > > TIFF *image; > > > > if((image = TIFFOpen("output.tif", "w")) == NULL){ > > printf("Could not open output.tif for writing\n"); > > exit(42); > > } > > TIFFClose(image); > >} > > > >I get the following error: > >% gcc -static -lm -ltiff -o write.o -ltiff write.c > >/tmp/ccfugoHj.o(.text+0x76):write.c: undefined reference to > `_TIFFOpen' > >/tmp/ccfugoHj.o(.text+0xa2):write.c: undefined reference to > >`_TIFFClose' > >collect2: ld returned 1 exit status > > > >According to the following troubleshooting it looks like it finds > >libtiff.a (or something): % gcc -static -lm -ltiffX -o > write.o -ltiff > >write.c > >/usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwi > n/bin/ld: > >cannot fi > >nd -ltiffX > >collect2: ld returned 1 exit status > > > >According to Cygwin Setup the tiff version is 3.5.7-1. gcc is v3.2 > >(20020927). > > > >% ls -l /usr/lib/libtiff.* > >-rwx------+ 1 hb None 316100 Feb 10 2002 > >/usr/lib/libtiff.a > >-rwx------+ 1 hb None 152620 Feb 10 2002 > >/usr/lib/libtiff.dll.a > > > >% ls -l /usr/include/tiff* > >-rwx------+ 1 hb None 24302 Feb 10 2002 > >/usr/include/tiff.h > >-rwx------+ 1 hb None 5254 Feb 10 2002 > >/usr/include/tiffconf.h > >-rwx------+ 1 hb None 14072 Feb 10 2002 > >/usr/include/tiffio.h > >-rwx------+ 1 hb None 11554 Feb 10 2002 > >/usr/include/tiffiop.h > >-rwx------+ 1 hb None 410 Feb 10 2002 > >/usr/include/tiffvers.h > > > >I appreciate any help. > > > >Cheers > > > >Henrik Bengtsson > > > > > > > >-- > >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/ > > _____________________________________________________________ > www.smokeJet.com - Free UK Internet Services > > _____________________________________________________________ > Select your own custom email address for FREE! Get > you AT yourchoice DOT com w/No Ads, 6MB, POP & more! > http://www.everyone.net/selectmail?> campaign=tag > > -- > > 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/ > > -- 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/