diff --git a/README.md b/README.md index fd9f654a7e..d773810c62 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,11 @@ GDAL is an open source X/MIT licensed translator library for raster and vector g * Download: ftp://ftp.remotesensing.org/gdal, http://download.osgeo.org/gdal * Wiki: http://trac.osgeo.org/gdal - Bug tracking, various user and developer contributed documentation and hints * Mailing list: http://lists.osgeo.org/mailman/listinfo/gdal-dev + +GDAL 1.11.x modifications for Visual Studio 2015 +==== +GDAL 1.11.x does not compile under Visual Studio 2015 out of the box. +This fork includes changes to fix that, namely: + + * Disabling of a conflicting preprocessor macro (`snprintf`). + * Inclusion of `legacy_stdio_definitions.lib` for ODBC support. diff --git a/gdal/nmake.opt b/gdal/nmake.opt index 890013557d..7a9229de8d 100644 --- a/gdal/nmake.opt +++ b/gdal/nmake.opt @@ -31,6 +31,7 @@ # Check version of Visual C++ compiler: # nmake -f makefile.vc MSVC_VER=xxxx # where xxxx is one of following: +# 1900 = 14.0(2015) # 1800 = 12.0(2013) # 1700 = 11.0(2012) # 1600 = 10.0(2010) @@ -41,8 +42,8 @@ # 1200 = 6.0 # !IFNDEF MSVC_VER -#assume msvc VS2008. -MSVC_VER=1500 +#assume msvc VS2015. +MSVC_VER=1900 !ENDIF ############################################################################### @@ -626,8 +627,13 @@ GDALLIB = $(GDAL_ROOT)/gdal_i.lib GDALLIB = $(GDAL_ROOT)/gdal.lib !ENDIF -!IFDEF ODBC_SUPPORTED -ODBCLIB = odbc32.lib odbccp32.lib user32.lib +# Fix from: http://stackoverflow.com/questions/33266542/linker-error-building-gdal +!IFDEF ODBC_SUPPORTED +!IF $(MSVC_VER) < 1900 +ODBCLIB = odbc32.lib odbccp32.lib user32.lib +!ELSE +ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib +!ENDIF !ENDIF !IF DEFINED(MRSID_DIR) || DEFINED(MRSID_RASTER_DIR) || DEFINED(MRSID_LIDAR_DIR) diff --git a/gdal/port/cpl_config.h.vc b/gdal/port/cpl_config.h.vc index bfff8f6663..b3f16396cc 100644 --- a/gdal/port/cpl_config.h.vc +++ b/gdal/port/cpl_config.h.vc @@ -17,7 +17,10 @@ #if defined(_MSC_VER) && (_MSC_VER < 1500) # define vsnprintf _vsnprintf #endif -#define snprintf _snprintf +/* RV: fixing compilation issues for Visual Studio 2015: */ +#if defined(_MSC_VER) && (_MSC_VER < 1900) +# define snprintf _snprintf +#endif #define HAVE_GETCWD 1 /* gmt_notunix.h from GMT project also redefines getcwd. See #3138 */