0)下载
libtiff下载:http://dl.maptools.org/dl/libtiff/
1) 编译 libtiff
把 tiff-3.8.2.tar.gz 解压,然后在 command line 里面进入该文件夹,
运行\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat
type : nmake /f Makefile.vc
修改.../libtiff/tiffconf.h.vc, 把其中的 /* #undef JPEG_SUPPORT */中的注释
/* */去掉。
tiffconf.vc内容如下:
/*
Configuration defines for installed libtiff.
This file maintained for backward compatibility. Do not use definitions
from this file in your programs.
*/
#ifndef _TIFFCONF_
#define _TIFFCONF_
/* Define to 1 if the system has the type `int16'. */
/* #undef HAVE_INT16 */
/* Define to 1 if the system has the type `int32'. */
/* #undef HAVE_INT32 */
/* Define to 1 if the system has the type `int8'. */
/* #undef HAVE_INT8 */
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format suported by the
machine */
#define HAVE_IEEEFP 1
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_LSB2MSB
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
(Intel) */
#define HOST_BIGENDIAN 0
/* Support CCITT Group 3 & 4 algorithms */
#define CCITT_SUPPORT 1
/* Support JPEG compression (requires IJG JPEG library) */
/* #undef JPEG_SUPPORT */
/* Support LogLuv high dynamic range encoding */
#define LOGLUV_SUPPORT 1
/* Support LZW algorithm */
#define LZW_SUPPORT 1
/* Support NeXT 2-bit RLE algorithm */
#define NEXT_SUPPORT 1
/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
fails with unpatched IJG JPEG library) */
/* #undef OJPEG_SUPPORT */
/* Support Macintosh PackBits algorithm */
#define PACKBITS_SUPPORT 1
/* Support Pixar log-format algorithm (requires Zlib) */
/* #undef PIXARLOG_SUPPORT */
/* Support ThunderScan 4-bit RLE algorithm */
#define THUNDER_SUPPORT 1
/* Support Deflate compression */
/* #undef ZIP_SUPPORT */
/* Support strip chopping (whether or not to convert single-strip uncompressed
images to mutiple strips of ~8Kb to reduce memory usage) */
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
/* Enable SubIFD tag (330) support */
#define SUBIFD_SUPPORT 1
/* Treat extra sample as alpha (default enabled). The RGBA interface will
treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
packages produce RGBA files but don't mark the alpha properly. */
#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
lacking the tag (default enabled). */
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
/*
* Feature support definitions.
* XXX: These macros are obsoleted. Don't use them in your apps!
* Macros stays here for backward compatibility and should be always defined.
*/
#define COLORIMETRY_SUPPORT
#define YCBCR_SUPPORT
#define CMYK_SUPPORT
#define ICC_SUPPORT
#define PHOTOSHOP_SUPPORT
#define IPTC_SUPPORT
#endif /* _TIFFCONF_ */
这是由于没有 libjpeg 库,然后删掉 .../libtiff/ 下的所有 .obj 文件。 然后再编译,这次就可以成功了。
2) 编译 Libgeotiff
在C:/下创建一个目录libgeotiff(路径也可以是其它的),把Libgeotiff解压到C:/libgeotiff/下,同时在C:/libgeotiff/创建一个libtiff(文件夹名一定要为libtiff),再到C:/ tiff-3.8.2/把编
译好的libtiff目录复制到C:/libgeotiff/libtiff/下,最后形成的目录结构如下所示:
/libgeotiff
/libgeotiff/libgeotiff-1.2.5
/libtiff
/libtiff/libtiff
注意目录结构一定要为上述结构,否则无法编译。
在命令提示符下,用“cd”命令定位到C: /libgeotiff/libgeotiff-1.2.5 ,输入以下命令:
nmake /f makefile.vc
4.安装
在命令提示符下,用“cd”命令定位到C: /libgeotiff/libgeotiff-1.2.5 ,依次输入以下命令:
nmake /f makefile.vc install
nmake /f makefile.vc devinstall
完成之后,在C:/就会生成usr目录,里面的文件就是你想要的。