boost::thread undefined reference

I copied this example exactly from the boost library examples.

#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();
}

I still get the error
undefined reference to boost::thread::join();

Anyone help me out?
It sounds like you aren't linking against the boost::thread library. boost::thread is not a header-only library.
That is the 2nd time I have gotten that answer.
But at http://www.boost.org/doc/libs/1_46_1/doc/html/thread.html

It says just include master header
http://www.boost.org/doc/libs/1_46_1/more/getting_started/windows.html#header-only-libraries
Here's what says that Boost.Thread must be built.

-Albatross
It works for me ,you need to link it to proper lib files libboost_thread-vc80-mt-gd-1_44.lib and
libboost_date_time-vc80-mt-gd-1_44.lib.
Topic archived. No new replies allowed.