【原創】關於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,struct std::map,class std::allocator >::_Kfn,struct std::less,class std::allocator >::_Node * __cdecl std::_Tree,struct std::map,class std::allocator >::_Kfn,struct std::less,class std::allocator >::_Max(struct std::_Tree,struct std::map,class std::allocator >::_Kfn,struct std::less,class std::allocator >::_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,struct std::map,class std::allocator >::_Kfn,struct std::less,class std::allocator >::_Node * __cdecl std::_Tree,struct std::map,class std::allocator >::_Kfn,struct std::less,class std::allocator >::_Max(struct std::_Tree,struct std::map,class std::allocator >::_Kfn,struct std::less,class std::allocator >::_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通過了。。目前還沒想清楚是什麼原理。。。。記錄下來供遇到此問題的朋友分享
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章