C++ STL 之deque 纠错,该如何处理
C++ STL 之deque 纠错
错误:
deque.obj : error LNK2001: unresolved external symbol "class stlpmtx_std::basic_ostream<char,class stlpmtx_std::char_traits<char> > stlpmtx_std::cout" (?cout@stlpmtx_std@@3V?$basic_ostream@DV?$char_traits@D@stlpmtx_std@@@1@A)
deque.obj : error LNK2001: unresolved external symbol "private: static void * __cdecl stlpmtx_std::D__A::_M_allocate(unsigned int &)" (?_M_allocate@D__A@stlpmtx_std@@CAPAXAAI@Z)
deque.obj : error LNK2001: unresolved external symbol "private: static void __cdecl stlpmtx_std::D__A::_M_deallocate(void *,unsigned int)" (?_M_deallocate@D__A@stlpmtx_std@@CAXPAXI@Z)
deque.obj : error LNK2001: unresolved external symbol "protected: void __thiscall stlpmtx_std::ios_base::_M_throw_failure(void)" (?_M_throw_failure@ios_base@stlpmtx_std@@IAEXXZ)
Debug/deque.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
deque.exe - 5 error(s), 0 warning(s)
不知是何原因 忘解答 谢谢
------解决方案--------------------
vc6.0?
------解决方案--------------------
链接错误,从代码上看很像 VC6.0的古老的 stl版本。
换个新的stl版本吧
------解决方案--------------------
------解决方案--------------------
int main(void)
这样吧... vs2010 的stl 是比较新的了
- C/C++ code
#include <string> #include <deque> #include <iostream> void main(void) { std::deque<std ::string> Mydeque; std::cout << "Good!" <<std::endl; }
错误:
deque.obj : error LNK2001: unresolved external symbol "class stlpmtx_std::basic_ostream<char,class stlpmtx_std::char_traits<char> > stlpmtx_std::cout" (?cout@stlpmtx_std@@3V?$basic_ostream@DV?$char_traits@D@stlpmtx_std@@@1@A)
deque.obj : error LNK2001: unresolved external symbol "private: static void * __cdecl stlpmtx_std::D__A::_M_allocate(unsigned int &)" (?_M_allocate@D__A@stlpmtx_std@@CAPAXAAI@Z)
deque.obj : error LNK2001: unresolved external symbol "private: static void __cdecl stlpmtx_std::D__A::_M_deallocate(void *,unsigned int)" (?_M_deallocate@D__A@stlpmtx_std@@CAXPAXI@Z)
deque.obj : error LNK2001: unresolved external symbol "protected: void __thiscall stlpmtx_std::ios_base::_M_throw_failure(void)" (?_M_throw_failure@ios_base@stlpmtx_std@@IAEXXZ)
Debug/deque.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
deque.exe - 5 error(s), 0 warning(s)
不知是何原因 忘解答 谢谢
------解决方案--------------------
vc6.0?
------解决方案--------------------
链接错误,从代码上看很像 VC6.0的古老的 stl版本。
换个新的stl版本吧
------解决方案--------------------
------解决方案--------------------
int main(void)
这样吧... vs2010 的stl 是比较新的了