2

I'm working on a multithreaded project in c++ and am trying to use a semaphore, from what I read in the documentation c++ has a semaphore, but when I try to include the header

#include <semaphore>

It does not autocomplete and I get a compiler error saying the header file is not recognized.
According to the documentation,

This header is part of the thread support library.

Does this mean I would need to add some prefix to the #include? Or include some other dependant header? I can't figure out why this won't work and I can't find anything about this anywhere, any help would be appreciated.

I'm on a temporary machine and just installed visual studio on it a couple of days ago, so everything should be up to date.

3
  • It is c++20 feature, i don`t know if there are compilers that support it, you probably need to to wait some time Commented May 29, 2020 at 16:27
  • If you look carefully at the documentation page you'll see that the whole thing is marked (since C++20). This standard hasn't been finalized yet so it shouldn't be surprising that your compiler hasn't implemented some of the features. Commented May 29, 2020 at 16:28
  • Oh I see, I had read since and assumed it was already a feature Commented May 29, 2020 at 16:36

1 Answer 1

4

As can be seen here, none of the listed compilers have currently implemented this c++20 feature.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.