|
#include "ace/Time_Value.h"
#include "ace/Log_Msg.h"
#include "ace/Synch.h"
#include "ace/Reactor.h"
#include "ace/Event_Handler.h"
#include "ace/Timer_Queue_Adapters.h"
#include "ace/Timer_Heap.h"
#include "ace/Timer_Wheel.h"
#include "ace/Thread_Manager.h"
typedef ACE_Thread_Timer_Queue_Adapter <ACE_Timer_Heap> ActiveTimer;
class CBA : public ACE_Event_Handler
{
public:
CBA (int id) : id_(id)
{
}
virtual int handle_timeout (const ACE_Time_Value &, const void *arg)
{
ACE_TRACE (ACE_TEXT ("CB::handle_timeout"));
const int *val = ACE_static_cast (const int *, arg);
ACE_ASSERT ((*val) == id_);
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Expiry handled by thread %d\n")));
return 0;
}
private:
int id_;
};
int ACE_TMAIN (int, ACE_TCHAR *[])
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("The main thread %t has started\n")));
ActiveTimer atimer;
atimer.activate();
CBA cb1(1);
int arg1 = 1;
const ACE_Time_Value curr_tv = ACE_OS::gettimeofday();
ACE_Time_Value interval = ACE_Time_Value (1, 1000);
long tid1 = atimer.schedule(&cb1, &arg1, curr_tv + ACE_Time_Value(3L), interval);
ACE_Thread_Manager::instance()->wait();
return 0;
};
上面是一个ACE定时器例子, 我编译的时候总是报如下错误:
--------------------Configuration: Test - Win32 Debug--------------------
Compiling...
Timer.cpp
Linking...
Timer.obj : error LNK2001: unresolved external symbol "unsigned long ACE_OS::NULL_thread" (?NULL_thread@ACE_OS@@3KA)
Debug/Test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Test.exe - 2 error(s), 0 warning(s)
在网上找了, 但没有找到相应的解决办法, 各位老大能帮我看下是啥原因不. |
|