fatal error C1189 with <experimental/coroutine> and <experimental/resumable> headers when compiling for c++20

Hi,

I am receiving the following error when I updated my build.cs file to use CppStandard = CppStandardVersion.Default which if I am not mistaken is c++20 in UE5.4.3:

D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\INCLUDE\experimental\coroutine(35): 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.

According to Microsoft, I need to compile with /await flag if the library I am using rely on #include <experimental/coroutine>. I tried updating the [project].target.cs file with AdditionalCompilerArguments += " /await "; but the same compilation error persists. Any help is greatly appreciated, thank you!

experimental/coroutines is really for non standard stuff (either legacy, or future features). Are you sure you really need the experimental headers? why not simply using the coroutines headers (without “experimental”) ?

Unfortunately the <experimental/coroutine> and/or <experimental/resumable> headers exist in c++/WinRT libraries which I am using. I am currently using the latest windows SDK that’s compatible with win10 so unless I forgo win10 support (assuming later version of windows SDK and c++/WinRT switched to using <coroutine>), my only option is to compile with /await flag if I want to use c++20 compilier.

According to UE5Coro Plugin, bEnableCppCoroutinesForEvaluation = true; can be added to .Build.cs file.

I have not personally tried it because I took a different approach of regenerating c++/WinRT header files via latest version of cppwinrt.exe which removed those incompatible headers. The version of c++/WinRT header files shipped with windows SDKs are outdated so by regenerating them for the target version of windows SKD helps make it compatible with c++20 and resolving several other compilation errors I encountered before. Hope this helps anyone who encounters similar issues in the future.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.