2004.07.28 20:00 "[Tiff] Building libtiff 3.7 with zlib 1.2.1 for windows with Visual CPP", by Larry Grill

2004.07.29 17:37 "Re: [Tiff] Building libtiff 3.7 with zlib 1.2.1 for windows with Visual CPP", by Andrey Kiselev

This applies to building libtiff 3.7 (or 3.6.1) with zlib 1.2.1 for windows with Visual CPP

I could not get the libtiff.dll or the tools exes to build when linking in zlib 1.2.1

It worked fine with zlib 1.1.4, but with 1.2.1 I got linker errors from MSVCRT.LIB

In case anyone else is having the same problem, here's how to fixed it:

In nmake.opt
Change:

LD = link /nologo

To

LD = link /nologo /NODEFAULTLIB:"MSVCRT.LIB"

In Makefile.vc (in the Tools directory)
Change:

$(CC) $(CFLAGS) $*.c $(EXTRA_OBJ) $(LIBS)

To:

$(CC) $(CFLAGS) $*.c /link /NODEFAULTLIB:"MSVCRT.LIB" $(EXTRA_OBJ) $(LIBS)

I'm not much of a batch file and command line kind of guy, so maybe Andrey or somebody else can do a better job of it. You'll probably want the conditional control statements for ZLIB support in there.

Hi, Larry,

It seems that the zlib and libtiff libraries are linked with the different runtime. By default MSVC uses /ML option (note, that there is no any runtime selection flags in the nmake.opt). Zlib builds with the /MD option, used in the appropriate makefile. So you should just add /MD to libtiff's CFLAGS (or use /ML in the zlib's CFLAGS) to resolve that issue.

Yes, I see that CFLAGS variable located under the message "There is nothing to edit below this line"... I shall write something more descriptive here.

Andrey

Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517