【问题标题】:Cannot use boost::threads in Visual Studio 2012无法在 Visual Studio 2012 中使用 boost::threads
【发布时间】:2013-03-25 17:46:00
【问题描述】:

我在 Visual Studio 2012(CTP 2012 年 11 月)中使用 boost::threads 时收到以下错误。我正在使用 boost 1.53。

1>boost/config/requires_threads.hpp(29): fatal error C1189: #error :  "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"

我在互联网上找到了使用多线程 c 运行时的建议。 (我是,不工作。)然后对于如何解决这个问题有一个巨大的沉默。 Boost 是否会放弃对 Visual Studio 的支持?

【问题讨论】:

  • 您确定没有定义 BOOST_DISABLE_THREADS 吗?如果是这样,请发布您正在编译的代码。据我所知,Visual Studio support 并没有丢失。
  • 发现问题。为了编写可移植代码的愚蠢希望,我禁用了语言扩展(switch /Za);)
  • 请提交答案,Stack Overflow 鼓励在您自己的问题上发布answer
  • @Zendel : 启用/Za 的次数比你想象的要多——我建议从不使用它,并通过使用多个编译器确保你的代码是可移植的。跨度>

标签: c++ visual-c++ boost visual-studio-2012 boost-thread


【解决方案1】:

如果禁用语言扩展(即切换 /Za),Visual Studio 中会自动禁用线程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-12
    • 1970-01-01
    • 2013-06-23
    • 2012-08-28
    • 1970-01-01
    • 2013-06-17
    相关资源
    最近更新 更多