Sid*_*kar 1 c++ semaphore visual-studio binary-semaphore
因此,我尝试在 Visual Studio 2019 和 2022 中使用counting_semaphore,但我得到的只是“std 没有成员counting_semaphore”。
在各个组件中添加 clang 11 后,我在 Visual Studio 2019 中进行了尝试,但仍然遇到相同的错误。然后我就想,好吧,它不支持 C++20。所以我想也许这就是它不起作用的原因。
然后我看到Vs2022 Preview支持C++20。所以我安装了它,包括在内,但我仍然无法执行“std::counting_semaphore<5> slot(5);” 正如它所说,std 没有一个名为计数信号量的成员。
我还在 2022 年预览安装程序的各个组件中安装了 clang12,但仍然无法正常工作。
我不确定我做错了什么。
我在网上看到例子:
https://www.modernnescpp.com/index.php/semaphores-in-c-20 https://en.cppreference.com/w/cpp/thread/counting_semaphore
告诉如何使用它,但是当我将代码放入 vs 中时,它不起作用。
我可以在#include 上“查看代码”,它显示了counting_semaphore 的实现,但我无法使用它!
请有人澄清我做错了什么!
你是否制定了c++语言标准?
Property -> General -> C++ Language Standard -> /std: c++ latest
我可以在 Visual Studio 2022 预览版 17.0.0 预览版 2.0 中成功构建。
我也可以在 Visual Studio 2019 中成功构建。
| 归档时间: |
|
| 查看次数: |
3740 次 |
| 最近记录: |