Opened 8 years ago

Closed 8 years ago

#6212 closed defect (fixed)

Windows HDF4 compilation broken

Reported by: Even Rouault Owned by: Kurt Schwehr
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: blocker Keywords:
Cc:

Description

Latest commits in HDF4 driver broke its compilation on Windows as seen in Tamas daily builds at http://build.gisinternals.com/sdk/Default.aspx

http://build.gisinternals.com/sdk/build-output/vc9-20151110-2-49-35-30-vc9-dev.txt :

	cl   /nologo /MD /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG /W4 /wd4127 /wd4251 /wd4275 /wd4786 /wd4100 /wd4245 /wd4206 /wd4018 /wd4389 /DHAVE_SSE_AT_COMPILE_TIME -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\port -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\ogr -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\gcore  -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\alg -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\ogr\ogrsf_frmts  -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\gnm -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\gnm\gnm_frmts -IC:\builds\..\sdk\vc9\gdal-trunk\gdal\apps  -I..\pds -IC:\builds\hdf-4.2.9\vc9\install\include -Ihdf-eos -DFRMT_hdf4 -DHDF4_PLUGIN -DOGR_ENABLED   -DGDAL_COMPILATION /c hdf4dataset.cpp hdf4imagedataset.cpp 
hdf4dataset.cpp
hdf4imagedataset.cpp
c:\sdk\vc9\gdal-trunk\gdal\frmts\hdf4\hdf4imagedataset.cpp(2379) : error C2589: '(' : illegal token on right side of '::'
c:\sdk\vc9\gdal-trunk\gdal\frmts\hdf4\hdf4imagedataset.cpp(2379) : error C2059: syntax error : '::'
c:\sdk\vc9\gdal-trunk\gdal\frmts\hdf4\hdf4imagedataset.cpp(2380) : error C2589: '(' : illegal token on right side of '::'
c:\sdk\vc9\gdal-trunk\gdal\frmts\hdf4\hdf4imagedataset.cpp(2380) : error C2059: syntax error : '::'

Might be due to the min/max macros defined in windows.h. See http://stackoverflow.com/questions/5004858/stdmin-gives-error / https://support.microsoft.com/en-us/kb/143208 I can indeed see that hdfi.h has a #include <windows.h>. Perhaps the Windows build should just set /DNOMINMAX globally in nmake.opt ? Hoping that would not have side effects elsewhere.

Change History (5)

comment:1 by Kurt Schwehr, 8 years ago

http://sourceforge.net/p/predef/wiki/OperatingSystems/

r31421 r31420

From EvenR:

$ cat test.c
#ifdef _WIN32
#error "yes"
#endif

>cl /c test.c
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
test.c(2) : fatal error C1189: #error :  "yes"

$ i586-mingw32msvc-gcc -c test.c
test.c:2:2: erreur: #error "yes"

comment:2 by Kurt Schwehr, 8 years ago

https://lists.osgeo.org/pipermail/gdal-dev/2015-November/043070.html

v:\gdal\frmts\hdf4\hdf4imagedataset.cpp(2386) : error C2784: '_Ty std::max(std::initializer_list<_Elem>,_Pr)' : could not deduce template argument for 'std::initializer_list<_Elem>' from 'int'
        c:\program files (x86)\microsoft visual studio 12.0\vc\include\algorithm(4108) : see declaration of 'std::max'

comment:3 by Kurt Schwehr, 8 years ago

r31463 attempts to help with possible issues with c++11 std::initializer_list

comment:4 by Kurt Schwehr, 8 years ago

Joaquim Luis reports success. Holding the ticket open for a few more days to check back on it.

Opened #6219 to track the warnings seen.

comment:5 by Even Rouault, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.