开发环境:VS2008
GDAL版本:1.8.1
另外需要支持:netcdf,hdf4,hdf5
下载GDAL1.8.1,解压缩,目录“d:\gdal1.8.1”。
下载netcdf-4.1.1-win32-bin,解压缩,目录“e:\netcdf”。
下载HDF5-1.8.7_win_x86,解压缩,目录“e:\hdf5”。
下载HDF4.2.6_win_x86,解压缩,目录“e:\hdf4”。
修改nmake.opt文件:
NETCDF_PLUGIN = yes
NETCDF_SETTING=yes
NETCDF_LIB=E:\netcdf\netcdf-4.1.1-bin\netcdf.lib
NETCDF_INC_DIR=E:\netcdf\netcdf-4.1.1\libsrc
# Uncomment the following and update to enable NCSA HDF Release 4 support.
HDF4_PLUGIN=NO
HDF4_DIR=E:\hdf4
HDF4_LIB=$(HDF4_DIR)\dll\hd426m.lib $(HDF4_DIR)\dll\hm426m.lib $(HDF4_DIR)\lib\hd426.lib
# Uncomment the following and update to enable NCSA HDF Release 5 support.
HDF5_PLUGIN=NO
HDF5_DIR=E:\hdf5
HDF5_LIB=$(HDF5_DIR)\dll\hdf5dll.lib
打开 makegdal90.vcproj(不知道为什么没有makegdal90.sln),编译。生成gdal1.8.dll。
若需要进行C#封装,需要执行下列步骤:
下载swigwin-1.3.40,解压缩,目录“e:\swigwin-1.3.40”。
执行vs2008命令行,进入目录“d:\gdal1.8.1\swig\csharp”。
执行“nmake /f makefile.vc interface”。
再执行“nmake /f makefile.vc”。
可以生成C#封装。
- NETCDF_PLUGIN = yes
- NETCDF_SETTING=yes
- NETCDF_LIB=E:\netcdf\netcdf-4.1.1-bin\netcdf.lib
- NETCDF_INC_DIR=E:\netcdf\netcdf-4.1.1\libsrc
- # Uncomment the following and update to enable NCSA HDF Release 4 support.
- HDF4_PLUGIN = YES
- HDF4_DIR = E:\hdf4\
- #HDF4_LIB = E:\hdf4\lib\hd426.lib
- HDF4_LIB = /LIBPATH:$(HDF4_DIR)\lib Ws2_32.lib
- # Uncomment the following and update to enable NCSA HDF Release 5 support.
- HDF5_PLUGIN = YES
- HDF5_DIR = e:\hdf5
- HDF5_LIB = $(HDF5_DIR)\dll\hdf5dll.lib