boost :: thread :: try_join_for()函数出错

问题描述 投票:0回答:1

我试图使用boost::thread::try_join_for()函数,但我得到以下编译时错误:

“'class boost :: thread'没有名为'try_join_for'的成员

我能够使用boost::thread::timed_join()功能。但我不想使用此函数,因为此函数已被弃用。

我目前的提升版本是1.66.0。以前,我有1.61.0,我想也许有一个bug,所以我把它更新为1.66.0。但仍然是同样的问题。

我还查看了头文件<boost/thread/detail/thread.hpp>。也许它似乎没有定义宏BOOST_THREAD_USES_CHRONO。虽然,我的IDE(QT)能够检测到宏已定义,因为如果我将其更改为#if !defined BOOST_THREAD_USES_CHRONO,则后面的块代码会变淡。

我的构建命令如下:

./bootstrap.sh --with-toolset = gcc

./bjam -d0 -a toolset = gcc-custom address-model = 64 architecture = x86 instruction-set = nocona variant = release threading = multi link = static stage

我甚至可以在构建输出中看到正在构建chrono组件。以下是部分输出:

- atomic                   : building
- chrono                   : building
- container                : building
- context                  : building
- coroutine                : building
- date_time                : building
- exception                : building
- fiber                    : building
- filesystem               : building
- graph                    : building
- graph_parallel           : building
- iostreams                : building
- locale                   : building
- log                      : building
- math                     : building
- mpi                      : building
- program_options          : building
- python                   : building
- random                   : building
- regex                    : building
- serialization            : building
- signals                  : building
- stacktrace               : building
- system                   : building
- test                     : building
- thread                   : building
- timer                    : building
- type_erasure             : building
- wave                     : building

我错过了什么吗?我正在Linux上构建。我的编译器版本是gcc-5.4。

谢谢。

linux boost c++14 boost-thread gcc5
1个回答
1
投票

看起来好像Wandbox不支持Boost 1.66,但是它与Boost 1.65.1一起快乐地编译:

简而言之,我猜测IDE的智能感知诊断,并简单地检查,例如,

#ifndef BOOST_THREAD_USES_CHRONO
    std::cout << "Yay\n";
#else
    std::cout << "Nay\n";
#endif
© www.soinside.com 2019 - 2024. All rights reserved.