--- a/src/kml/base/file_win32.cc
+++ b/src/kml/base/file_win32.cc
@@ -34,15 +34,18 @@
 #include "kml/base/file.h"
 #include <windows.h>
 #include <tchar.h>
+#ifndef __MINGW32__
 #include <xstring>
+#endif
 #include <algorithm>
 
 namespace kmlbase {
 
+#ifndef __MINGW32__
 // 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' '); // fix for msvc: empty literal
   std::copy(str.begin(), str.end(), wstr.begin());
   return wstr;
 }
@@ -56,13 +59,18 @@ string Wstr2Str(const std::wstring& wstr) {
                       static_cast<int>(s), NULL, NULL);
   return str;
 }
+#endif
 
 bool File::Exists(const string& full_path) {
   if (full_path.empty()) {
     return false;
   }
+#ifndef __MINGW32__
   std::wstring wstr = Str2Wstr(full_path);
   DWORD attrs = ::GetFileAttributes(wstr.c_str());
+#else
+  DWORD attrs = ::GetFileAttributes(full_path.c_str());
+#endif
   return (attrs != INVALID_FILE_ATTRIBUTES) &&
     ((attrs & FILE_ATTRIBUTE_DIRECTORY) == 0);
 }
@@ -71,8 +79,12 @@ bool File::Delete(const string& filepath) {
   if (filepath.empty()) {
     return false;
   }
+#ifndef __MINGW32__
   std::wstring wstr = Str2Wstr(filepath);
   return ::DeleteFile(wstr.c_str()) ? true : false;
+#else
+  return ::DeleteFile(filepath.c_str()) ? true : false;
+#endif
 }
 
 static const unsigned int BUFSIZE = 1024;
@@ -97,8 +109,12 @@ bool File::CreateNewTempFile(string* path) {
   if (uRetVal == 0) {
     return false;
   }
+#ifndef __MINGW32__
   string str = Wstr2Str(szTempName);
   path->assign(str.c_str(), strlen(str.c_str()));
+#else
+  path->assign(szTempName, strlen(szTempName));
+#endif
   return true;
 }
 
