|
Boost Users : |
Subject: Re: [Boost-users] error: âclass boost::mutexâ has no member named âtry_lock_forâ
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-09-28 00:23:39
On 26/09/2018 01:30, Antonis Polykratis wrote:
> I face this error, in linux, does this indicates that I have not build
> the library correctly?
> the error is in that line:
> boost/thread/lock_types.hpp:162:45
>
>
> #ifdef BOOST_THREAD_USES_CHRONO
> Â Â template <class Clock, class Duration>
> Â Â unique_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t)
> Â Â : m(&mtx), is_locked(mtx.try_lock_until(t))
> Â Â {
> Â Â }
> Â Â template <class Rep, class Period>
> Â Â unique_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d)
> Â Â : m(&mtx), is_locked(mtx.try_lock_for(d))Â <--- here is the error
> Â Â {
> Â Â }
> #endif
This is a header-level error, so the issue is presumably in your
compiler settings.
(Both unique_lock::try_lock_until and mutex::try_lock_until only exist
when BOOST_THREAD_USES_CHRONO is defined, but that shouldn't normally be
different in two headers within the same translation unit.)
Make sure that your include paths are picking up the expected version of
Boost and that you're not accidentally mixing system Boost with local Boost.
You can also try generating a preprocessed file by copying the full
command line which is currently being used to compile the source with
the error, then changing the -c parameter to -E and changing the -o
parameter's extension from .o to .i. Then examine the contents of the
file to see where it is picking up the various definitions from; this
may help locate the source of the issue.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net