cppwinrt: VS2019 16.9 compile error: implement pre-C++20 coroutine support. Use for standard C++20 coroutines
I have a UWP/cppwinrt project which I build with CMake. In the latest VS2019 Version 16.9.0 I am unable to compile:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\experimental\coroutine(37,1): fatal error C1189: #error: The <experimental/coroutine> and <experimental/resumable> headers are only supported with /await and implement pre-C++20 coroutine support. Use <coroutine> for standard C++20 coroutines. (compiling source file C:\Users\Application_UWP.cpp)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\experimental\coroutine(37,1): fatal error C1189: #error: The <experimental/coroutine> and <experimental/resumable> headers are only supported with /await and implement pre-C++20 coroutine support. Use <coroutine> for standard C++20 coroutines. (compiling source file C:\Users\Application_Impl_UWP.cpp)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\experimental\coroutine(37,1): fatal error C1189: #error: The <experimental/coroutine> and <experimental/resumable> headers are only supported with /await and implement pre-C++20 coroutine support. Use <coroutine> for standard C++20 coroutines. (compiling source file C:\Users\Application.cpp)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (1 by maintainers)
Update Windows SDK to 10.0.22000.0(with Visual Studio Installer) may help to solve the
cppwinrt
problem. https://github.com/SpriteOvO/AirPodsDesktop/issues/48#issuecomment-1733144738Oh, no if you’re using cppwinrt from the Windows SDK then this isn’t supported. Support for C++20 coroutines was added recently and hasn’t made it into the Windows SDK.
You should only use
/await
if you’re targeting C++17. If you’re targeting later versions this flag is not required and will cause this error.