Skip to content

Commit

Permalink
Merge pull request #1 from ShinNoNoir/vs2015-compile-fix
Browse files Browse the repository at this point in the history
VS2015 compile fix
  • Loading branch information
ShinNoNoir authored Jan 11, 2017
2 parents ecf6e26 + ce99b8e commit d81ac95
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
14 changes: 10 additions & 4 deletions gdal/nmake.opt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -41,8 +42,8 @@
# 1200 = 6.0
#
!IFNDEF MSVC_VER
#assume msvc VS2008.
MSVC_VER=1500
#assume msvc VS2015.
MSVC_VER=1900
!ENDIF

###############################################################################
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion gdal/port/cpl_config.h.vc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit d81ac95

Please sign in to comment.