使用STLPORT常會因為某個地方的筆誤,引起其他地方大量的編譯錯誤,其錯誤定位比較麻煩,因為使用的是VC6,對C++支持比較差,所以更是讓人頭疼,Ice3.3VC6的版本使用了STLPort 4.6.2,在編譯時,Release版本沒問題,Debug版本卻忽然報了一大堆的錯誤:
:\ice-3.3.0-vc60\include\stlport\stl\debug\_iterator.h(127) : error C2504: '__owned_link' : base class undefined
d:\ice-3.3.0-vc60\include\stlport\stl\debug\_iterator.h(173) : see reference to class template instantiation '_STL::_DBG_iter_base<_Container>' being compiled
d:\ice-3.3.0-vc60\include\stlport\stl\debug\_iterator.h(146) : error C2629: unexpected 'struct _STL::_DBG_iter_base<_Container> ('
d:\ice-3.3.0-vc60\include\stlport\stl\debug\_iterator.h(173) : see reference to class template instantiation
。。。。。
后來我試著在stdafx.h加了一個開關
#ifdef _DEBUG
#define _STLP_DEBUG
#endif
問題解決,STLPORT諸如此類的開關好像還有很多,詳細的請參見STLPort的編譯說明
#define _STLP_USE_MFC 1 //使用MFC
#define _STLP_USE_MFC 1
#ifdef _STLP_NEW_PLATFORM_SDK
#undef _STLP_NEW_PLATFORM_SDK
#endif