Hi! This is most probably a "newbie question", but I really don't see what exactly wrong I'm doing, so will appreciate any inputs.
Basically, what I'm trying to do is:
using namespace boost::posix_time;
using namespace boost::this_thread;
time_duration td = milliseconds(2000);
sleep(&td);
And it works ok with Visual Studio and Windows. Once I get it to linux and try to compile with gcc, this is what I get:
g++ -c -Wall -I/home/gsed/boost/ main.cpp -o main.o
In file included from /home/gsed/boost/boost/thread/thread.hpp:17:0,
from includes.h:12,
from main.cpp:1:
/home/gsed/boost/boost/thread/pthread/thread_data.hpp: In function void boost::this_thread::sleep(const TimeDuration&) [with TimeDuration = boost::posix_time::time_duration*]:
main.cpp:47:11: instantiated from here
/home/gsed/boost/boost/thread/pthread/thread_data.hpp:138:13: error: no match for operator+ in boost::get_system_time() + rel_time
/home/gsed/boost/boost/date_time/time.hpp:139:15: note: candidates are: time_type boost::date_time::base_time<T, time_system>::operator+(boost::date_time::base_time<T, time_system>::date_duration_type&) const [with T = boost::posix_time::ptime, time_system = boost::date_time::counted_time_system<boost::date_time::counted_time_rep<boost::posix_time::millisec_posix_time_system_config> >, time_type = boost::posix_time::ptime, boost::date_time::base_time<T, time_system>::date_duration_type = boost::gregorian::date_duration]
/home/gsed/boost/boost/date_time/time.hpp:159:15: note: time_type boost::date_time::base_time<T, time_system>::operator+(boost::date_time::base_time<T, time_system>::time_duration_type&) const [with T = boost::posix_time::ptime, time_system = boost::date_time::counted_time_system<boost::date_time::counted_time_rep<boost::posix_time::millisec_posix_time_system_config> >, time_type = boost::posix_time::ptime, boost::date_time::base_time<T, time_system>::time_duration_type = boost::posix_time::time_duration]
/home/gsed/boost/boost/date_time/posix_time/date_duration_operators.hpp:75:3: note: boost::posix_time::ptime boost::posix_time::operator+(const boost::posix_time::ptime&, const boost::gregorian::years&)
/home/gsed/boost/boost/date_time/posix_time/date_duration_operators.hpp:31:3: note: boost::posix_time::ptime boost::posix_time::operator+(const boost::posix_time::ptime&, const boost::gregorian::months&)
make: *** [main.o] Error 1
ie it's trying to perform a boost::posix_time::ptime + time_duration operation, but for some reason can't decide between
operator+(boost::date_time::base_time<T, time_system>::date_duration_type&) and
operator+(boost::date_time::base_time<T, time_system>::time_duration_type&)
And I'm absolutely not sure why.
Win version works well I guess because there's another include file used and the whole thing is arranged differently.
Again, any inputs or advice are greatly appreciated. Thanks!
--
Take care,
Alexey Malakhov