error: '__gnu_cxx::_Lock_policy' has not been declared
第一次開博客,不知道寫什么好,隨便記錄一下今天遇見的問題吧。
第一次使用shared_ptr就出現(xiàn)了這個(gè)問題:
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:81:20: error: '__gnu_cxx::_Lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:82:20: error: '__gnu_cxx::__default_lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:83:20: error: '__gnu_cxx::_S_single' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:84:20: error: '__gnu_cxx::_S_mutex' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:85:20: error: '__gnu_cxx::_S_atomic' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:88:12: error: '_Lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:97:23: error: '_S_mutex' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:97:31: error: template argument 1 is invalid
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:99:5: error: expected class-name before '{' token
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:107:12: error: '_Lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:107:31: error: '__default_lock_policy' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:210:22: error: '_S_single' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:210:31: error: template argument 1 is invalid
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:211:21: error: '_M_add_ref_lock' is not a template function
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:222:22: error: '_S_mutex' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:222:30: error: template argument 1 is invalid
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:223:21: error: '_M_add_ref_lock' is not a template function
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:235:22: error: '_S_atomic' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:235:31: error: template argument 1 is invalid
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:236:21: error: '_M_add_ref_lock' is not a template function
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:253:46: error: '_Lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:284:12: error: '_Lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:284:31: error: '__default_lock_policy' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:295:12: error: '_Lock_policy' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:295:31: error: '__default_lock_policy' was not declared in this scope
c:\mingw\bin\../lib/gcc/mingw32/4.6.1/include/c++/tr1/shared_ptr.h:336:37: error: expected ')' before '<' token
?
上網(wǎng)搜了一下發(fā)現(xiàn)要include? tr1/memory
加了以后還是無法編譯
最后發(fā)現(xiàn)要把#include <tr1/memory>放在#include <tr1/shared_ptr.h>前面才行,真神奇……
轉(zhuǎn)載于:https://www.cnblogs.com/Psyche/archive/2012/06/18/error__gnu_cxx_Lock_policy_has_not_been_declared.html
總結(jié)
以上是生活随笔為你收集整理的error: '__gnu_cxx::_Lock_policy' has not been declared的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ext JS 4.1.1 RC2发布
- 下一篇: 年月日正则