简体   繁体   English

如何在Visual Studio中使用C ++ 11线程

[英]How to use C++11 threading with Visual Studio

Before I start I want to explain that I am a novice and that it's highly possible that I've missed something simple or that there's something simple that I just don't know about. 在开始之前,我想解释一下我是新手,很可能错过了一些简单的事情,或者只是我不知道的简单事情。

Using visual studio I wanted to get a bit of threading practice in but I can't get it to include at the top of my code. 我想使用Visual Studio进行一些线程练习,但是无法将其包含在代码的顶部。 I know that is new to C++11 but I'm not sure if that's enabled for Visual Studio 2010 or if it isn't I'm not sure how I would go about doing that. 我知道这是C ++ 11的新功能,但是我不确定是否为Visual Studio 2010启用了该功能,或者不确定是否为该功能启用了。

Here is a screenshot of my code: 这是我的代码的屏幕截图:

我的密码

You cannot: C++11's Thread support library is not supported by the implementation of the C++ Standard Library shipped with VS2010. 您不能:VS2010附带的C ++标准库的实现不支持C ++ 11的线程支持库。 You should upgrade to VS2012 if you want to use it. 如果要使用它,应升级到VS2012。

Alternatively, you could use Boost.Thread , which served as an inspiration for C++11's Standard Thread support library. 另外,您可以使用Boost.Thread ,它是C ++ 11的标准线程支持库的灵感来源。

As a further option, you could consider purchasing the Just.Thread library, which provides a complete implementation and is available for VS2010 as well. 作为进一步的选择,您可以考虑购买Just.Thread库,该库提供了完整的实现,并且也可用于VS2010。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM