[Ace-users] [ace-users] ACE_Hash_Map_Manager will not link if static
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Fri Jan 4 16:46:01 CST 2008
To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form (PRF),
which is in
in older versions of ACE+TAO. Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness. If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
> Here is my problem; I need to have a singleton type object that the whole system sees only one copy of the object. This
> object will manage a key/value pair of queue IDs and queue objects. To do this I have an object that has all static
> attributes and methods. This will ensure that all references to the object will work on the same copy. Since these are key/
> value pairs I want to use some sort of map (or hash table) since the keys have to be unique. The class looks something
> typedef ACE_Hash_Map_Manager<int, QueueObject *, ACE_Null_Mutex> EventMap;
> class EventDispatcher
> static EventMap m_queueList;
> static bool CreateStaticQueue(int P_queueID);
> static bool DestroyQueue(int P_queueID);
> If I declare the EventMap and the methods without the static keyword the code links. Once I declare the EventMap and the
> methods static I get an unresolved symbol error in the linker:
> error LNK2001: unresolved external symbol "private: static class ACE_Hash_Map_Manager<int,class QueueObject *,class
> ACE_Null_Mutex> EventDispatcher::m_queueList" (?m_queueList at EventDispatcher@@0V?
> $ACE_Hash_Map_Manager at HPAVQueueObject@@VACE_Null_Mutex@@@@A)
> What do I have to do to get the ACE_Hash_Map_Manager to link as a static?
I think this is a C++ question, not an ACE question. Please see
for how to do this.
More information about the Ace-users