Open KyrMitsos opened 2 years ago
WIL requires a relatively up to date compiler. It should build with VS 2019 and VS 2022. Not sure about VS 2017, but as you've seen it doesn't build on VS 2015.
Thank you sylveon.
Is this something reported to you from other VS2015 users?
Dear WIL team,
My VS2015 IDE is: Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.8.04084
My CL.exe is the default that comes with the above IDE (not sure about the version of C++ it supports), however I know that VS2015 does not seem to offer you the /std option to choose a version of C++, like the VS2017 upwards do.
I am trying to use WIL in my project with:
include <wil/com.h>
And trying to compile, I get the following all related to result_macros.h:
1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(1227): error C2440: 'return': cannot convert from 'initializer list' to 'wil::details::ResultStatus' 1> \packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(1227): note: No constructor could take the source type, or constructor overload resolution was ambiguous 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(1231): error C2440: 'return': cannot convert from 'initializer list' to 'wil::details::ResultStatus' 1> \packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(1231): note: No constructor could take the source type, or constructor overload resolution was ambiguous 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(1235): error C2440: 'return': cannot convert from 'initializer list' to 'wil::details::ResultStatus' 1> \packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(1235): note: No constructor could take the source type, or constructor overload resolution was ambiguous 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(2035): error C2144: syntax error: 'HRESULT' should be preceded by ';' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(2035): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(2041): error C2144: syntax error: 'HRESULT' should be preceded by ';' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(2041): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(2041): error C2086: 'int wil::details::_Translates_last_error_toHRESULT': redefinition 1> \packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(2035): note: see declaration of 'wil::details::_Translates_last_error_toHRESULT' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3906): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3906): error C2059: syntax error: '(' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3918): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3918): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3926): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3926): error C2059: syntax error: '(' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3936): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3936): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C2143: syntax error: missing ';' before '<' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C2495: 'ReportFailure_GetLastError': 'declspec(noinline)' can only be applied to function declarations or definitions 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C3829: standard attribute 'noreturn' may only be applied to functions 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C2433: 'ReportFailure_GetLastError': 'inline' not permitted on data declarations 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C2495: 'wil::details::ReportFailure_GetLastError': '__declspec(noinline)' can only be applied to function declarations or definitions 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3944): error C2059: syntax error: '<' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3954): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3954): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3964): error C2144: syntax error: 'HRESULT' should be preceded by ';' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3974): error C2144: syntax error: 'HRESULT' should be preceded by ';' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3974): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3974): error C2143: syntax error: missing ';' before '<' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3985): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3985): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3993): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(3993): error C2059: syntax error: '(' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4005): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4005): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4013): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4013): error C2059: syntax error: '(' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4023): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4023): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4065): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4065): error C2059: syntax error: '(' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4077): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4077): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4085): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4085): error C2059: syntax error: '(' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4095): error C2143: syntax error: missing ';' before '{' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4095): error C2447: '{': missing function header (old-style formal list?) 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): error C2988: unrecognizable template declaration/definition 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): error C2143: syntax error: missing ';' before '<' 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): error C2495: 'ReportFailure_GetLastErrorMsg': 'declspec(noinline)' can only be applied to function declarations or definitions 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): error C3829: standard attribute 'noreturn' may only be applied to functions 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): error C2433: 'ReportFailure_GetLastErrorMsg': 'inline' not permitted on data declarations 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): error C2495: 'wil::details::ReportFailure_GetLastErrorMsg': '__declspec(noinline)' can only be applied to function declarations or definitions 1>\packages\microsoft.windows.implementationlibrary.1.0.220201.1\include\wil\result_macros.h(4103): fatal error C1903: unable to recover from previous error(s); stopping compilation 1> INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe' 1> Please choose the Technical Support command on the Visual C++ 1> Help menu, or open the Technical Support help file for more information ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Could this be due to a wrong C++ version the compiler supports? My project is somehow old and uses MBCS, I would expect for there to be an issue with WIL using Unicode chars, however none of the above seem to be pointing to anything like that.
Any ideas?
You are my last resort, I haven't been able to find a solution on any of the forums out there.
Thank you very much.