【原创】关于STL::_Lockit的问题

今天在帮Norains 兄实验map的时候遇到一个问题

在VS2005的环境下调试STL的map类,出现了以下的问题

1>maptest.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAA@XZ),该符号在函数 "protected: static struct std::_Tree<unsigned long,struct std::pair<unsigned long const ,unsigned long>,struct std::map<unsigned long,unsigned long,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Kfn,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Node * __cdecl std::_Tree<unsigned long,struct std::pair<unsigned long const ,unsigned long>,struct std::map<unsigned long,unsigned long,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Kfn,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Max(struct std::_Tree<unsigned long,struct std::pair<unsigned long const ,unsigned long>,struct std::map<unsigned long,unsigned long,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Kfn,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Node *)" (?_Max@?$_Tree@KU?$pair@$$CBKK@std@@U_Kfn@?$map@KKU?$less@K@std@@V?$allocator@K@2@@2@U?$less@K@2@V?$allocator@K@2@@std@@KAPAU_Node@12@PAU312@@Z) 中被引用
1>maptest.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAA@XZ),该符号在函数 "protected: static struct std::_Tree<unsigned long,struct std::pair<unsigned long const ,unsigned long>,struct std::map<unsigned long,unsigned long,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Kfn,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Node * __cdecl std::_Tree<unsigned long,struct std::pair<unsigned long const ,unsigned long>,struct std::map<unsigned long,unsigned long,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Kfn,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Max(struct std::_Tree<unsigned long,struct std::pair<unsigned long const ,unsigned long>,struct std::map<unsigned long,unsigned long,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Kfn,struct std::less<unsigned long>,class std::allocator<unsigned long> >::_Node *)" (?_Max@?$_Tree@KU?$pair@$$CBKK@std@@U_Kfn@?$map@KKU?$less@K@std@@V?$allocator@K@2@@2@U?$less@K@2@V?$allocator@K@2@@std@@KAPAU_Node@12@PAU312@@Z) 中被引用

一开始研究了好一会,以为是库少了,后来看到一个帖子CSDN上的

是wince区的一个老帖子,很多大牛都没有解决这个问题,最后LZ说是lockit的问题

解决办法是在程序中定义一下lockit函数,具体如下:

::_Lockit::_Lockit(){};

::_Lockit::~_Lockit(){};
就build通过了。。目前还没想清楚是什么原理。。。。记录下来供遇到此问题的朋友分享

你可能感兴趣的:(Lock)