Lastly sorry with the spam, is an urgent matter.

FULL CODE(POC):

#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
#include <iostream>

struct thread_alarm
{
thread_alarm(int secs) : m_secs(secs) { }
void operator()()
{
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC);
xt.sec += m_secs;

boost::thread::sleep(xt);

std::cout << "alarm sounded..." << std::endl;
}

int m_secs;
};

int main(int argc, char* argv[])
{
int secs = 5;
std::cout << "setting alarm for 5 seconds..." << std::endl;
thread_alarm alarm(secs);
boost::thread thrd(alarm);
thrd.join();
}

ATTEMPT:

g++ -lcurl -lboost_thread -lboost_date_time -lpthread -pthread d.c -o app
/tmp/ccLh0FfM.o: In function `boost::thread::sleep(boost::posix_time::ptime const&)':
d.c:(.text._ZN5boost6thread5sleepERKNS_10posix_time5ptimeE[boost::thread::sleep(boost::posix_time::ptime const&)]+0xd): undefined reference to `boost::this_thread::sleep(boost::posix_time::ptime const&)'
collect2: ld returned 1 exit status

Much thanks in advance with this nasty issue.

John Dawson

On Tue, Dec 16, 2008 at 2:48 AM, John D <cononet@gmail.com> wrote:
I think this is also relevant to add:

ls -la /usr/lib/libboost_date_time*
-rw-r--r-- 1 root root 53000 2008-11-18 14:15 /usr/lib/libboost_date_time-mt.so.1.35.0
lrwxrwxrwx 1 root root    40 2008-12-15 21:54 /usr/lib/libboost_date_time.so -> /usr/lib/libboost_date_time-mt.so.1.35.0
-rw-r--r-- 1 root root 52952 2008-11-18 14:15 /usr/lib/libboost_date_time.so.1.35.0

Thanks,
John


On Tue, Dec 16, 2008 at 2:13 AM, John D <cononet@gmail.com> wrote:
I regretfully failed to mention that i had tried that and base on what I had read, it was not even needed.

All the same:

 g++ -lcurl -lboost_thread -lboost_date_time -lpthread -pthread c.cpp -o app
/tmp/cclPzgNH.o: In function `void boost::this_thread::sleep<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000ll> >(boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000ll> const&)':

c.cpp:(.text._ZN5boost11this_thread5sleepINS_9date_time18subsecond_durationINS_10posix_time13time_durationELx1000EEEEEvRKT_[void boost::this_thread::sleep<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000ll> >(boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000ll> const&)]+0x50): undefined reference to `boost::this_thread::sleep(boost::posix_time::ptime const&)'
collect2: ld returned 1 exit status

Also to add.

ldconfig -v | grep boost
ldconfig: Can't stat /lib64: No such file or directory
ldconfig: Cannot stat /usr/lib64/libmudflap.so: No such file or directory
ldconfig: Cannot stat /usr/lib64/libmudflapth.so: No such file or directory
        libboost_thread-mt.so.1.35.0 -> libboost_thread.so
        libboost_wserialization.so.1.35.0 -> libboost_wserialization.so.1.35.0
        libboost_serialization-mt.so.1.35.0 -> libboost_serialization-mt.so.1.35.0
        libboost_wserialization-mt.so.1.35.0 -> libboost_wserialization-mt.so.1.35.0
        libboost_date_time-mt.so.1.35.0 -> libboost_date_time.so
        libboost_date_time.so.1.35.0 -> libboost_date_time.so.1.35.0
        libboost_serialization.so.1.35.0 -> libboost_serialization.so.1.35.0

Hope this helps,
I am desperately in need of freeing a time slice for continually looping threads.

John



On Tue, Dec 16, 2008 at 2:06 AM, Jonathan Franklin <franklin.jonathan@gmail.com> wrote:
On Mon, Dec 15, 2008 at 5:01 PM, Ravi <lists_ravi@lavabit.com> wrote:
On Monday 15 December 2008 16:55:03 John D wrote:
> g++ -lcurl -lboost_thread -lpthread -pthread c.cpp -o app

Add -lboost_data_time to get the time definitions.

That is of course date_time.  My fingers do that all the time.
;-)

Jon

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users