[gdal-dev] GDAL 2.2.0 Compilation error with OSX 10.12

Ruedi Boesch ruedi.boesch at wsl.ch
Fri May 12 14:01:16 PDT 2017


with http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz
==>
==> no member named 'back' in 'CPLString'
==>
configure ... --enable-pdf-plugin ...

Compiling with macos 10.12 (toolchain XCode 8.3 (Apple LLVM version 8.1.0
(clang-802.0.42))) fails in 
gdal-2.2.0/frmts/pdf/pdfcreatecopy.cpp:2342

PROBLEM: configure defines HAVE_CXX11, but emits
libtool: compile:  g++ -std=gnu++11 ...

(c++11 supports std:string::back(), but gnu++11 not ??)

==> WORKAROUND:
In
gdal-2.2.0/port/cpl_string.h:383 

change

#ifndef HAVE_CXX11

to

// Note: This is standard in C++11.
#if defined (__APPLE__) || !defined (HAVE_CXX11)
    /** Return last character (undefined behaviour if string is empty) */
    const char& back() const { return operator[](size()-1); }
    /** Return last character (undefined behaviour if string is empty) */
    char& back() { return operator[](size()-1); }
#endif

Ruedi








--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GDAL-2-2-0-Compilation-error-with-OSX-10-12-tp5320401.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list