Opened 9 years ago
Last modified 5 years ago
#9379 closed Bugs
'boost::chrono::steady_clock' has not been declared" on boost 1.55, hp-ux 11.23 IA, gcc 4.6 — at Version 8
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | chrono |
Version: | Boost 1.58.0 | Severity: | Problem |
Keywords: | steady_clock | Cc: |
Description (last modified by )
../lib/include/boost/boost/thread/pthread/recursive_mutex.hpp: In member function 'bool boost::recursive_timed_mutex::try_lock_for(const boost::chrono::duration<Rep, Period>&)': ../lib/include/boost/boost/thread/pthread/recursive_mutex.hpp:357:41: error: 'boost::chrono::steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread.hpp:24:0, from ../src/ ... ../lib/include/boost/boost/thread/future.hpp: In member function 'boost::future_status boost::detail::basic_future<R>::wait_for(const boost::chrono::duration<Rep2, Period2>&) const': ../lib/include/boost/boost/thread/future.hpp:1395:37: error: 'boost::
Change History (10)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Hi experts, The problem can be reproduced easily,
uname -a HP-UX B.11.23 U ia64 $gcc -v gcc version 4.6.3 (GCC)
$cat thread.cpp
<
#include <string> #include <iostream> #include <boost/thread.hpp> using namespace std; class BankAccount; BankAccount JoesAccount; void bankAgent() { for (int i =10; i>0; --i) { //... JoesAccount.Deposit(500); //... } } void Joe() { for (int i =10; i>0; --i) { //... int myPocket = JoesAccount.Withdraw(100); std::cout << myPocket << std::endl; //... } } int main() { //... boost::thread thread1(bankAgent); // start concurrent execution of bankAgent boost::thread thread2(Joe); // start concurrent execution of Joe thread1.join(); thread2.join(); return 0; }
Error: < irvspxue:builder> g++ -Iboost_1_55_0 -o thread thread.cpp In file included from boost_1_55_0/boost/thread/mutex.hpp:16:0, from boost_1_55_0/boost/thread/pthread/thread_data.hpp:13, from boost_1_55_0/boost/thread/thread_only.hpp:17, from boost_1_55_0/boost/thread/thread.hpp:12, from boost_1_55_0/boost/thread.hpp:13, from thread.cpp:5: boost_1_55_0/boost/thread/pthread/mutex.hpp: In member function 'bool boost::timed_mutex::try_lock_for(const boost::chrono::duration<Rep, Period>&)': boost_1_55_0/boost/thread/pthread/mutex.hpp:309:41: error: 'boost::chrono::steady_clock' has not been declared In file included from boost_1_55_0/boost/thread/pthread/thread_data.hpp:14:0, from boost_1_55_0/boost/thread/thread_only.hpp:17, from boost_1_55_0/boost/thread/thread.hpp:12, from boost_1_55_0/boost/thread.hpp:13, from thread.cpp:5: boost_1_55_0/boost/thread/pthread/condition_variable_fwd.hpp: In member function 'boost::cv_status boost::condition_variable::wait_for(boost::unique_lock<boost::mutex>&, const boost::chrono::duration<Rep, Period>&)': >
comment:3 by , 9 years ago
Status: | new → assigned |
---|
comment:4 by , 9 years ago
HI,
please could you check the boost/chrono/config.hpp file.
It contains the following
# if defined( BOOST_CHRONO_WINDOWS_API ) # ifndef UNDER_CE # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # endif # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_MAC_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif
Does your platform meets the condition for which BOOST_CHRONO_HAS_CLOCK_STEADY is defined?
comment:5 by , 9 years ago
I tested the micro, it is NOT defined under hp-ux ia 11.23, hp-ux pa 11.11, and solaris 8/9. But is defined under AIX 5.2.
$uname -a HP-UX machinename B.11.23 U ia64 unlimited-user license
$cat micro.cpp #include <string> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <boost/chrono/config.hpp> using namespace std;
int main() { #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
printf("boost_chrono_has_clock_steady is defined!\n");
#else
printf("boost_chrono_has_clock_steady is not defined!\n");
#endif
return 0;
}
$g++ -Iboost_1_55_0 -o micro micro.cpp
$./micro boost_chrono_has_clock_steady is not defined!
Thanks.
comment:6 by , 9 years ago
I was requesting you to analyze why it is not defined. It is because CLOCK_MONOTONIC is not defined? If yes, could you find if there is something like that?
by , 9 years ago
Attachment: | user_time.h added |
---|
by , 9 years ago
Attachment: | user_sys_time.h added |
---|
comment:7 by , 9 years ago
Hi Viboes, You are right, CLOCK_MONOTONIC is not defined. I have attached /usr/include/time.h and /usr/include/sys/time.h files. Thanks.
comment:8 by , 9 years ago
Description: | modified (diff) |
---|
./lib/include/boost/boost/thread/pthread/condition_variable.hpp: In member function 'boost::cv_status boost::condition_variable_any::wait_for(lock_type&, const boost::chrono::duration<Rep2, Period>&)': ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:295:11: error: 'steady_clock' has not been declared ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:295:36: error: expected ';' before 'c_now' ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:297:18: error: 'steady_clock' has not been declared ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:297:40: error: 'c_now' was not declared in this scope ../lib/include/boost/boost/thread/pthread/condition_variable.hpp: In member function 'bool boost::condition_variable_any::wait_for(lock_type&, const boost::chrono::duration<Rep, Period>&, Predicate)': ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:310:43: error: 'boost::chrono::steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread/thread_only.hpp:26:0,
../lib/include/boost/boost/thread/v2/thread.hpp: At global scope: ../lib/include/boost/boost/thread/v2/thread.hpp:59:47: error: 'steady_clock' is not a member of 'boost::chrono' ../lib/include/boost/boost/thread/v2/thread.hpp:59:47: error: 'steady_clock' is not a member of 'boost::chrono' ../lib/include/boost/boost/thread/v2/thread.hpp:59:77: error: template argument 1 is invalid ../lib/include/boost/boost/thread/v2/thread.hpp: In function 'void boost::this_thread::sleep_until(const int&)': ../lib/include/boost/boost/thread/v2/thread.hpp:62:21: error: 'steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread/shared_mutex.hpp:22:0,