使用clang-cl编译
代码编译遇到
The <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> headers do not support Clang,
but the C++20 <coroutine> header does
这个错误只需要
clang-cl /D_SILENCE_CLANG_COROUTINE_MESSAGE test.cpp
原因是 microsoft/STL coroutine这个文件里有一行
#if defined(__clang__) && !defined(_SILENCE_CLANG_COROUTINE_MESSAGE)
#error The <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> \
headers do not support Clang, but the C++20 <coroutine> header does.
#endif // defined(__clang__) && !defined(_SILENCE_CLANG_COROUTINE_MESSAGE)
所以只需要用-D选项加上_SILENCE_CLANG_COROUTINE_MESSAGE
解决问题。
解决clang-cl协程头文件报错
851

被折叠的 条评论
为什么被折叠?



