andreasbuhr / cppcoro

A library of C++ coroutine abstractions for the coroutines TS
MIT License
364 stars 53 forks source link

Can not run non-experimental <coroutine> #85

Closed Brendan-Jacobson1 closed 6 months ago

Brendan-Jacobson1 commented 6 months ago

If I try to compile my code with cppcoro I get

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\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 for standard C++20 coroutines.

I can't use /await since I want to use cppcoro with the latest boost asio. My code doesn't have <experimental/coroutine> it has #include . It looks like this branch chooses #include <experimental/coroutine> or #include based on something. The readme says "Automatically including 'coroutine' or 'experimental/coroutine', depending on compiler." Has anybody gotten this to work with their compiler? Is there a list of compilers that use non-experimental 'coroutine'?

Im not sure if this is what https://github.com/andreasbuhr/cppcoro/tree/unify_experimental_includes is for. I did try to build it but when I followed the instructions cake.bat, I don't think cake.bat did anything

""" \cppcoro>cake.bat

Build succeeded. Build took 0:00:00.172. """

no dll was created

Has anybody gotten cppcoro to run with ? I'm using MSVC but if I need to change the compiler I can (preferably one that works on windows and maybe linux).

andreasbuhr commented 6 months ago

Please check which branch you are using. This repository does not contain a file named "cake.bat". It got deleted years ago.

Brendan-Jacobson1 commented 6 months ago

Most of my time trying to get it to work has been on the main branch that uses cmake to build. The unify_experimental_includes was just the last thing I tried.

andreasbuhr commented 6 months ago

Could you please provide the CMake output when running CMake for the first time in a freshly created build folder? In the main branch?

andreasbuhr commented 6 months ago

Is the problem solved for you?

Brendan-Jacobson1 commented 6 months ago

Yes, it is working now. Sorry for not responding quickly enough. I think the issue was caused by me using the visual studio generator instead of using ninja (since it wasn't working on my system at the time, but I forgot to mention this). I got thrown off because it would appear to build correctly with no errors. I appreciate you responding and trying to help.

Brendan-Jacobson1 commented 6 months ago

The issue was not caused by the repo and has been resolved.