WIL library is not compatible with MinGW(-W64) now, mostly because of gcc, which doesn't recognize some non-standard syntax. I also tried clang for mingw-w64, but it gave different errors.
In file included from test.cpp:1:
In file included from C:\msys64\mingw64\include\wil/result.h:16:
In file included from C:\msys64\mingw64\include\wil/result_macros.h:17:
C:\msys64\mingw64\include\wil/common.h:261:1: error: C++ requires a type specifier for all declarations
WI_ODR_PRAGMA("WIL_KERNEL_MODE", "0")
^
C:\msys64\mingw64\include\wil/common.h:256:37: note: expanded from macro 'WI_ODR_PRAGMA'
#define WI_ODR_PRAGMA(NAME, TOKEN) __pragma(detect_mismatch("ODR_violation_" NAME "_mismatch", TOKEN))
^
C:\msys64\mingw64\include\wil/common.h:261:1: error: use of undeclared identifier 'detect_mismatch'
C:\msys64\mingw64\include\wil/common.h:256:46: note: expanded from macro 'WI_ODR_PRAGMA'
#define WI_ODR_PRAGMA(NAME, TOKEN) __pragma(detect_mismatch("ODR_violation_" NAME "_mismatch", TOKEN))
^
C:\msys64\mingw64\include\wil/common.h:470:6: error: linker pragma must include g_header_init variation
#error linker pragma must include g_header_init variation
^
C:\msys64\mingw64\include\wil/common.h:261:38: error: expected ';' after top level declarator
WI_ODR_PRAGMA("WIL_KERNEL_MODE", "0")
^
In file included from test.cpp:1:
In file included from C:\msys64\mingw64\include\wil/result.h:16:
C:\msys64\mingw64\include\wil/result_macros.h:93:1: error: C++ requires a type specifier for all declarations
WI_ODR_PRAGMA("WIL_AllocateMemory", "1")
^
C:\msys64\mingw64\include\wil/common.h:256:37: note: expanded from macro 'WI_ODR_PRAGMA'
#define WI_ODR_PRAGMA(NAME, TOKEN) __pragma(detect_mismatch("ODR_violation_" NAME "_mismatch", TOKEN))
^
In file included from test.cpp:1:
In file included from C:\msys64\mingw64\include\wil/result.h:16:
C:\msys64\mingw64\include\wil/result_macros.h:93:1: error: use of undeclared identifier 'detect_mismatch'
C:\msys64\mingw64\include\wil/common.h:256:46: note: expanded from macro 'WI_ODR_PRAGMA'
#define WI_ODR_PRAGMA(NAME, TOKEN) __pragma(detect_mismatch("ODR_violation_" NAME "_mismatch", TOKEN))
^
In file included from test.cpp:1:
In file included from C:\msys64\mingw64\include\wil/result.h:16:
C:\msys64\mingw64\include\wil/result_macros.h:93:41: error: expected ';' after top level declarator
WI_ODR_PRAGMA("WIL_AllocateMemory", "1")
^
In file included from test.cpp:1:
In file included from C:\msys64\mingw64\include\wil/result.h:16:
In file included from C:\msys64\mingw64\include\wil/result_macros.h:123:
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:129:30: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCopyWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR pszSrc);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:131:32: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCopyExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:131:105: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCopyExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:133:31: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCopyNWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR pszSrc,size_t cchToCopy);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:135:33: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCopyNExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,size_t cchToCopy,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:135:123: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCopyNExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,size_t cchToCopy,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:137:29: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCatWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR pszSrc);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:139:31: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCatExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:139:104: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCatExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:141:30: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCatNWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,STRSAFE_LPCSTR pszSrc,size_t cchToAppend);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:143:32: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCatNExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,size_t cchToAppend,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
C:\msys64\mingw64\x86_64-w64-mingw32\include\strsafe.h:143:124: error: unknown type name 'STRSAFE_LPSTR'
STRSAFEAPI StringCatNExWorkerA(STRSAFE_LPSTR pszDest,size_t cchDest,size_t cbDest,STRSAFE_LPCSTR pszSrc,size_t cchToAppend,STRSAFE_LPSTR *ppszDestEnd,size_t *pcchRemaining,unsigned __LONG32 dwFlags);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
WIL library is not compatible with MinGW(-W64) now, mostly because of gcc, which doesn't recognize some non-standard syntax. I also tried clang for mingw-w64, but it gave different errors.
test file:
g++:
It is too long, and is attached as file.
gcc.log
clang++: