Installing LibTiff to Visual Studio 2010

hevele picture hevele · Sep 29, 2012 · Viewed 10.5k times · Source

Possible Duplicate:
Using LibTiff in Visual Studio 2010

I have been trying to work with libtiff library but I couldnt get it working. I looked up the installation notes but still I couldn't manage to build it. I used setup but since it fails to find lots of header files when I try to use it. Is there any step by step guide that you could recommend explaining where to put source files or how to include? I am searching and trying for hours, still couldnt find anything.

Answer

David L. picture David L. · Sep 29, 2012

The GnuWin32 page you link to seems to be mostly about building LibTIFF with GCC (CygWin or Mingw).

There is a section on LibTIFF home page about Building the Software under Windows 95/98/NT/2000 with MS VC++ :


With Microsoft Visual C++ installed, and properly configured for commandline use (you will likely need to source VCVARS32.BAT in AUTOEXEC.bAT or somewhere similar) you should be able to use the provided makefile.vc.

The source package is delivered using Unix line termination conventions, which work with MSVC but do not work with Windows 'notepad'. If you use unzip from the Info-Zip package, you can extract the files using Windows normal line termination conventions with a command similar to:


  unzip -aa -a tiff-4.0.0.zip

By default libtiff expects that a pre-built zlib and jpeg library are provided by the user. If this is not the case, then you may edit libtiff\tiffconf.h using a text editor (e.g. notepad) and comment out the entries for JPEG_SUPPORT, PIXARLOG_SUPPORT, and ZIP_SUPPORT. Ignore the comment at the top of the file which says that it has no influence on the build, because the statement is not true for Windows. However, by taking this approach, libtiff will not be able to open some TIFF files.

To build using the provided makefile.vc you may use:


  C:\tiff-4.0.0> nmake /f makefile.vc clean
  C:\tiff-4.0.0> nmake /f makefile.vc

or (the hard way)


  C:\tiff-4.0.0> cd port
  C:\tiff-4.0.0\port> nmake /f makefile.vc clean
  C:\tiff-4.0.0\port> nmake /f makefile.vc
  C:\tiff-4.0.0> cd ../libtiff
  C:\tiff-4.0.0\libtiff> nmake /f makefile.vc clean
  C:\tiff-4.0.0\libtiff> nmake /f makefile.vc
  C:\tiff-4.0.0\libtiff> cd ..\tools
  C:\tiff-4.0.0\tools> nmake /f makefile.vc clean
  C:\tiff-4.0.0\tools> nmake /f makefile.vc

This will build the library file libtiff\libtiff\libtiff.lib. This can be used in Win32 programs. You may want to adjust the build options before start compiling. All parameters contained in the nmake.opt file.This is a plain text file you can open with your favorite text editor.

The makefile also builds a DLL (libtiff.dll) with an associated import library (libtiff_i.lib). Any builds using libtiff will need to include the LIBTIFF\LIBTIFF directory in the include path.

The libtiff\tools\makefile.vc should build .exe's for all the standard TIFF tool programs.