Libgdal Compilation with MinGW

49 views
Skip to first unread message

Rodolfo Bonnin

unread,
Apr 6, 2011, 2:32:27 PM4/6/11
to libkml
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.

Stillwatereng

unread,
Jan 31, 2012, 9:37:46 PM1/31/12
to lib...@googlegroups.com
Funny what you find when you take time and just browse around.  I had come up with the same problem, and a very similar fix.  But even though it compiled, I had no confidence it would work right, and fell back to just using expat.  I think I'll give libkml another shot.
Thanks
Reply all
Reply to author
Forward
0 new messages