|
Boost Users : |
Subject: [Boost-users] Linker error for thread methods
From: Marc Riese (marc-riese_at_[hidden])
Date: 2008-09-04 07:41:49
Hi,
I'm trying to use the boost::thread library in an own dll with Visual Studio 2003. I'm using boost 1.36.0 and built it myself with bjam according to http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html
First I tested with a simple example, that I've found somewhere in the documentation:
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::this_thread::sleep(xt);
}
int m_secs;
};
boost::thread thrd(thread_alarm(1));
This code runs and compiles fine. I can add a loop and some couts in the operator() for example and get the output parallel to my application.
But when I uncomment the line boost::this_thread::sleep(xt);, I get the following linker error:
error LNK2019: unresolved external symbol "bool __stdcall boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_wait_at_this_thread_at_boost@@YG_NPAXUtimeout_at_detail@2@@Z) referenced in function "void __stdcall boost::this_thread::interruptible_wait(class boost::posix_time::ptime const &)" (?interruptible_wait_at_this_thread_at_boost@@YGXABVptime_at_posix_time_at_2@@Z)
The same occurs for other thread methods like yield().
I assume there's a problem with the calling convention, but using something other than __stdcall is not an option for me, since I have to comply with a given specification.
I didn't find any information about calling conventions in the boost documentation. Is there a solution for this, or does the boost::thread library require the __cdecl calling convention?
Regards,
Marc
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