[gdal-dev] Libgdal Compilation with MinGW

Rodolfo Bonnin rodolfobonnin at suremptec.com.ar
Wed Apr 6 11:02:02 EDT 2011


Hello all,

I am trying to compile gdal using CMake with MinGW 4.4, and had the
following errors:

______________________________
[...]libkml-1.2.0/src/kml/base/file_win32.cc:3
5:19: error: xstring: No such file or directory
[...]libkml-1.2.0/src/kml/base/file_win32.cc:4
3:35: error: empty character constant
______________________________

So I changed the file_win32 , obtaining the following diff:
____________________________________
--- src/kml/base/file_win32.cc     Wed Jan 13 21:16:30 2010
+++ src/kml/base/file_win32.cc   Wed Apr  6 10:50:27 2011
@@ -32,7 +32,6 @@
 #include "kml/base/file.h"
 #include <windows.h>
 #include <tchar.h>
-#include <xstring>
 #include <algorithm>

 namespace kmlbase {
@@ -40,7 +39,7 @@
 // Internal to the win32 file class. We need a conversion from string to
 // LPCWSTR.
 static std::wstring Str2Wstr(const string& str) {
-  std::wstring wstr(str.length(), L'');
+  std::wstring wstr(str.length(), L' ');
  std::copy(str.begin(), str.end(), wstr.begin());
  return wstr;
 }

_________________________________________________

After that the library compiled OK.

This was a quick fix, and I have to check it for correctness, any
comments are welcome regarding a better way to fix the compilation
(Conditional code to check for MinGW before including xstring for
example)

Regards and thanks in advance.

--
Ing. Rodolfo Bonnin
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina "B" (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
rodolfobonnin at suremptec.com.ar
www.suremptec.com



-- 
Ing. Rodolfo Bonnin
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina "B" (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
rodolfobonnin at suremptec.com.ar
www.suremptec.com


More information about the gdal-dev mailing list