diff --git a/lang/c/examples/CMakeLists.txt b/lang/c/examples/CMakeLists.txt
index 1c96b71c48ac94fcb264d4308ab44daf378083b5..5028575aaee1e7f93ee2a24e552aa6ab21eeef65 100644
--- a/lang/c/examples/CMakeLists.txt
+++ b/lang/c/examples/CMakeLists.txt
@@ -20,11 +20,11 @@
 add_executable(quickstop quickstop.c)
 target_link_libraries(quickstop avro-static)
 
-if (WIN32)
+if (WIN32 AND NOT MINGW)
     set(exec_name ${CMAKE_CURRENT_BINARY_DIR}/Debug/quickstop.exe)
-else (WIN32)
+else (WIN32 AND NOT MINGW)
     set(exec_name ${CMAKE_CURRENT_BINARY_DIR}/quickstop)
-endif (WIN32)
+endif (WIN32 AND NOT MINGW)
 
 add_test(quickstop
     ${CMAKE_COMMAND} -E chdir ${AvroC_SOURCE_DIR}/examples
diff --git a/lang/c/src/avro/platform.h b/lang/c/src/avro/platform.h
index 929305505f43ddc3e1b5f4e16623fd1058ed5b4d..0cadbe71e54dba37fdef28b4e8143b22ba6a1434 100644
--- a/lang/c/src/avro/platform.h
+++ b/lang/c/src/avro/platform.h
@@ -26,7 +26,7 @@ extern "C" {
 
 /* Use this header file to include platform specific definitions */
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW32__)
   #include <avro/msinttypes.h>
 #else
   #include <inttypes.h>
diff --git a/lang/c/src/CMakeLists.txt b/lang/c/src/CMakeLists.txt
index c1761c8defbae75606dd75eff54a82d8ed9a85ea..232318253ffc8eff94fe67230bc7a07f7309bb18 100644
--- a/lang/c/src/CMakeLists.txt
+++ b/lang/c/src/CMakeLists.txt
@@ -88,7 +88,7 @@ add_library(avro-static STATIC ${AVRO_SRC})
 target_link_libraries(avro-static ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES})
 set_target_properties(avro-static PROPERTIES OUTPUT_NAME avro)
 
-if (NOT WIN32)
+if (NOT WIN32 OR MINGW)
 # TODO: Create Windows DLLs. See https://www.cmake.org/Wiki/BuildingWinDLL
 add_library(avro-shared SHARED ${AVRO_SRC})
 target_link_libraries(avro-shared ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES})
@@ -96,7 +96,7 @@ set_target_properties(avro-shared PROPERTIES
         OUTPUT_NAME avro
         VERSION ${LIBAVRO_DOT_VERSION}
         SOVERSION ${LIBAVRO_SOVERSION})
-endif(NOT WIN32)
+endif(NOT WIN32 OR MINGW)
 
 install(FILES
         ${CMAKE_CURRENT_SOURCE_DIR}/avro.h
@@ -108,19 +108,19 @@ install(DIRECTORY
 
 include(GNUInstallDirs)
 
-if (WIN32)
+if (WIN32 AND NOT MINGW)
 install(TARGETS avro-static
 	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        )
-else(WIN32)
+else(WIN32 AND NOT MINGW)
 install(TARGETS avro-static avro-shared
 	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
 	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        )
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 # Install pkg-config file
 
@@ -138,7 +138,7 @@ add_executable(avroappend avroappend.c)
 target_link_libraries(avroappend avro-static)
 install(TARGETS avroappend RUNTIME DESTINATION bin)
 
-if (NOT WIN32)
+if (NOT WIN32 OR MINGW)
 #TODO: Port getopt() to Windows to compile avropipe.c and avromod.c
 add_executable(avropipe avropipe.c)
 target_link_libraries(avropipe avro-static)
@@ -147,4 +147,4 @@ install(TARGETS avropipe RUNTIME DESTINATION bin)
 add_executable(avromod avromod.c)
 target_link_libraries(avromod avro-static)
 install(TARGETS avromod RUNTIME DESTINATION bin)
-endif(NOT WIN32)
+endif(NOT WIN32 OR MINGW)
diff --git a/lang/c/tests/CMakeLists.txt b/lang/c/tests/CMakeLists.txt
index 2e84a06a31c11b3e333fbc4be7975cd1cd4dd113..7f757e4876ec584b5f04b28260c2237e009279c5 100644
--- a/lang/c/tests/CMakeLists.txt
+++ b/lang/c/tests/CMakeLists.txt
@@ -28,11 +28,11 @@ endmacro(add_avro_executable)
 
 macro(add_avro_test name)
     add_avro_executable(${name} ${ARGN})
-    if (WIN32)
+    if (WIN32 AND NOT MINGW)
         set(exec_name ${CMAKE_CURRENT_BINARY_DIR}/Debug/${name}.exe)
-    else (WIN32)
+    else (WIN32 AND NOT MINGW)
         set(exec_name ${CMAKE_CURRENT_BINARY_DIR}/${name})
-    endif (WIN32)
+    endif (WIN32 AND NOT MINGW)
 
     add_test(${name}
         ${CMAKE_COMMAND} -E chdir ${AvroC_SOURCE_DIR}/tests
diff --git a/lang/c/tests/test_interop_data.c b/lang/c/tests/test_interop_data.c
index 4738f318298d9662fbcb2b860ddc678408c76bc1..db90b7a712c175dfa9cf1c67d1ec8081be3e73b2 100644
--- a/lang/c/tests/test_interop_data.c
+++ b/lang/c/tests/test_interop_data.c
@@ -20,6 +20,7 @@
 #include <dirent.h>
 #include <stddef.h>
 #include <stdio.h>
+#include <sys/stat.h>
 
 int should_test(char *d_name)
 {
@@ -82,12 +83,14 @@ int main(int argc, char *argv[])
     }
 
     struct dirent *ent;
+    struct stat file_info;
     while ((ent = readdir(dir)) != NULL)
     {
         avro_file_reader_t reader;
         avro_value_t value;
 
-        if (ent->d_type != DT_REG) continue;
+        stat(ent->d_name, &file_info);
+        if (!S_ISREG(file_info.st_mode)) continue;
 
         char *d_name = ent->d_name;
         size_t d_name_len = strlen(d_name);
diff --git a/lang/c/CMakeLists.txt b/lang/c/CMakeLists.txt
index 6c8d7aaf3f0a20832699448a82d43f9236330f60..f3a013c4ab6c838fe485dc4b046d53f38df85177 100644
--- a/lang/c/CMakeLists.txt
+++ b/lang/c/CMakeLists.txt
@@ -29,8 +29,9 @@ cmake_policy(SET CMP0003 NEW)
 #-----------------------------------------------------------------------
 # Retrieve the current version number
 
-if (UNIX)
-    execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/version.sh project
+if (UNIX OR MINGW)
+    find_program(BASH_EXECUTABLE bash HINTS ${CMAKE_PREFIX_PATH}/../usr/bin)
+    execute_process(COMMAND ${BASH_EXECUTABLE} version.sh project
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         RESULT_VARIABLE AVRO_VERSION_RESULT
         OUTPUT_VARIABLE AVRO_VERSION
@@ -39,7 +40,7 @@ if (UNIX)
         message(FATAL_ERROR "Cannot determine Avro version number")
     endif(AVRO_VERSION_RESULT)
 
-    execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/version.sh libtool
+    execute_process(COMMAND ${BASH_EXECUTABLE} version.sh libtool
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         RESULT_VARIABLE LIBAVRO_VERSION_RESULT
         OUTPUT_VARIABLE LIBAVRO_VERSION
@@ -48,7 +49,7 @@ if (UNIX)
         message(FATAL_ERROR "Cannot determine libavro version number")
     endif(LIBAVRO_VERSION_RESULT)
 
-    execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/version.sh libcurrent
+    execute_process(COMMAND ${BASH_EXECUTABLE} version.sh libcurrent
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         RESULT_VARIABLE LIBAVRO_SOVERSION_RESULT
         OUTPUT_VARIABLE LIBAVRO_SOVERSION
@@ -57,11 +58,11 @@ if (UNIX)
         message(FATAL_ERROR "Cannot determine libavro version number")
     endif(LIBAVRO_SOVERSION_RESULT)
 
-else(UNIX)
+else(UNIX OR MINGW)
     # Hard code for win32 -- need to figure out how to port version.sh for
     # Windows.
     set(LIBAVRO_VERSION "22:0:0")
-endif(UNIX)
+endif(UNIX OR MINGW)
 
 
 #-----------------------------------------------------------------------
@@ -107,10 +108,10 @@ if(CMAKE_COMPILER_IS_GNUCC)
     add_definitions(-W -Wall)
 endif(CMAKE_COMPILER_IS_GNUCC)
 
-if (WIN32)
+if (WIN32 AND NOT MINGW)
    # Compile win32 in C++ to allow declarations after statements
    add_definitions(/TP)
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
 
 # Uncomment to allow missing fields in the resolved-writer
 # add_definitions(-DAVRO_ALLOW_MISSING_FIELDS_IN_RESOLVED_WRITER)
diff --git a/lang/c++/api/Config.hh b/lang/c++/api/Config.hh
index 69d36f2abe1622ca50f319a6340e778051c10073..cea6ce39965ed461c1e6ef8339c18d899b11e5c0 100644
--- a/lang/c++/api/Config.hh
+++ b/lang/c++/api/Config.hh
@@ -33,7 +33,9 @@
 #endif  // AVRO_DYN_LINK
 
 #include <intsafe.h>
+#ifndef __MINGW32__
 typedef SSIZE_T ssize_t;
+#endif
 
 #endif  // _WIN32
 
diff --git a/lang/c++/impl/avrogencpp.cc b/lang/c++/impl/avrogencpp.cc
index bdbca28debbb7e8ecb8ee4beeede4315c5d08b99..ed8f55d151481c5aa31f93fa9a02c84cba53b5b7 100644
--- a/lang/c++/impl/avrogencpp.cc
+++ b/lang/c++/impl/avrogencpp.cc
@@ -788,6 +788,11 @@ void CodeGen::generate(const ValidSchema& schema)
 
 namespace po = boost::program_options;
 
+#ifdef OUT
+#undef OUT
+#undef IN
+#endif
+
 static const string NS("namespace");
 static const string OUT("output");
 static const string IN("input");
diff --git a/lang/c++/test/DataFileTests.cc b/lang/c++/test/DataFileTests.cc
index 4f94d80daa7ad902b5d0b6852ce6c9d216651e05..72213e3b3d79a71f7ed24f8a1ca54b9ee7046e23 100644
--- a/lang/c++/test/DataFileTests.cc
+++ b/lang/c++/test/DataFileTests.cc
@@ -455,10 +455,8 @@ public:
     // lang/java/avro/src/test/java/org/apache/avro/TestDataFile.java.
     void testReaderSplits() {
         boost::mt19937 random(static_cast<uint32_t>(time(0)));
+        int length = std::ifstream (filename, std::ifstream::ate | std::ifstream::binary).tellg();
         avro::DataFileReader<ComplexInteger> df(filename, writerSchema);
-        std::ifstream just_for_length(
-            filename, std::ifstream::ate | std::ifstream::binary);
-        int length = just_for_length.tellg();
         int splits = 10;
         int end = length;      // end of split
         int remaining = end;   // bytes remaining
diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
index 69feee5b1197350da889f1d8cb3d2385f7cb1cc8..b79d9d4cfd855e5697b4c9fcca113285a306a84a 100644
--- a/lang/c++/CMakeLists.txt
+++ b/lang/c++/CMakeLists.txt
@@ -42,7 +42,7 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
 project (Avro-cpp)
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
 
-if (WIN32 AND NOT CYGWIN AND NOT MSYS)
+if (WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT MINGW)
     add_definitions (/EHa)
     add_definitions (
         -DNOMINMAX
@@ -191,9 +191,9 @@ set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}")
 include (CPack)
 
 install (TARGETS avrocpp avrocpp_s
-    LIBRARY DESTINATION lib
-    ARCHIVE DESTINATION lib
-    RUNTIME DESTINATION lib)
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 install (TARGETS avrogencpp RUNTIME DESTINATION bin)
 
