0

For <semaphore>, Error is there - fatal error: semaphore: No such file or directory. I want to use std::counting_semaphore<1> prepareSignal(0);

  • [Why don't C++ standard headers' names end with '.h' or '.hpp'?](https://www.quora.com/Why-dont-C-standard-headers-names-end-with-h-or-hpp) – Jason Sep 01 '22 at 07:42
  • See [dupe](https://stackoverflow.com/a/40628360/12002570) which says: *"C++ standard library was able to drop extensions in C++98 due to the introduction of namespaces..."* – Jason Sep 01 '22 at 07:44
  • From C++20 onwards, you can use `` instead of `semaphore.h`. See warning [here](https://godbolt.org/z/qhE8zfxEn) by msvc. – Jason Sep 01 '22 at 07:49
  • Which compiler you're using? Also make sure that you're using C++20 because `std::counting_semaphore` can only be used from c++20 and onwards. Also, it maybe that the compiler you're using doesn't yet implemented this. You can try your program with other compilers with C++20 and it should work. – Jason Sep 01 '22 at 07:51
  • @JasonLiam -- but, as some smart person points out, that line that the C++ standard "was able to drop extensions ... due to the introduction of namespaces" is nonsense. The two have nothing to do with one another. – Pete Becker Sep 01 '22 at 13:04
  • @PeteBecker Yes, i agree. I read your comment [here](https://stackoverflow.com/questions/40624930/c-header-files-with-no-extension/40628360#comment68500878_40628360) also. – Jason Sep 01 '22 at 13:07

0 Answers0