Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#5459 closed defect (fixed)

VRT: vrtsources.cpp doesn't compile with mingw(-w64) in C++11 mode

Reported by: akhliustov Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: ConfigBuild Version: unspecified
Severity: normal Keywords: CPL, VRT
Cc:

Description

Change History (6)

comment:1 by Even Rouault, 10 years ago

On Ubuntu 12.04 with clang 3.4, I've configured with

CC="/home/vagrant/clang+llvm-3.4-x86_64-unknown-ubuntu12.04/bin/clang" CXX="/home/vagrant/clang+llvm-3.4-x86_64-unknown-ubuntu12.04/bin/clang++ -std=c++11" ./configure

and found 2 errors (not really related with c+11 by the way) and fixed them in r27279, but it didn't report any issue with vrtsources.cpp

comment:2 by akhliustov, 10 years ago

An investigation shows that the problem may be caused by an interaction between libstdc++ and glibc: the latter not only defines isnan as a macro but also declares it as a function (see <bits/mathcalls.h>) and that symbol survives the inclusion of <cmath>.

One of the affected configurations is mingw-w64; it doesn't use glibc and its <math.h> doesn't declare isnan as a function.
I'll have a look at another configuration (a variant of RHEL 6) on monday.

comment:3 by akhliustov, 10 years ago

Summary: VRT: vrtsources.cpp doesn't compile with libstdc++ in C++11 modeVRT: vrtsources.cpp doesn't compile with mingw(-w64) in C++11 mode

Well, the issue seems to be mingw(-w64)-specific, so I've changed the summary.

comment:4 by akhliustov, 10 years ago

Anyway, the workaround is to move #include <algorithm> and the definition of VRTComplexSource::LookupValue (which uses std::lower_bound) to the end of the file.

comment:5 by Even Rouault, 10 years ago

Component: GDAL_RasterConfigBuild
Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r27359 "Fix compilation with mingw-w64 cross compiler in -std=c++11 mode (#5459)"

comment:6 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.