开发者

include tr1::shared_ptr

开发者 https://www.devze.com 2023-02-14 21:51 出处:网络
I have included #include </usr/include/c++/4.4.3/tr1/shared_ptr.h> in my class file, When I attemptto compile my class I get below error:

I have included #include </usr/include/c++/4.4.3/tr1/shared_ptr.h> in my class file, When I attempt to compile my class I get below error:

> In file included from account.h:16:0:
/usr/include/c++/4.4.3/tr1/shared_ptr.h:61:46: error: '_Lock_policy' has not been declared
/usr/include/c++/4.4.3/tr1/shared_ptr.h:63:30: error: expected template-name before '<' token
/usr/include/c++/4.4.3/tr1/shared_ptr.h:63:30: error: expected '{' before '<' token
/usr/include/c++/4.4.3/tr1/shared_ptr.h:63:30: error: expected unqualified-id before '<' token
/usr/include/c++/4.4.3/tr1/shared_ptr.h:89:12: error: '_Lock_policy' has not been declared
/usr/include/c++/4.4.3/tr1/shared_ptr.h:89:31: error: '__default_lock_policy' was not declared in this scope
/usr/include/c++/4.4.3/tr1/shared_ptr.h:100:12: error: '_Lock_policy' has not be开发者_开发百科en declared
/usr/include/c++/4.4.3/tr1/shared_ptr.h:100:31: error: '__default_lock_policy' was not declared in this scope
/usr/include/c++/4.4.3/tr1/shared_ptr.h:209:7: error: '_Sp_counted_base' does not name a type
/usr/include/c++/4.4.3/tr1/shared_ptr.h: In constructor 'std::tr1::__shared_count<_Lp>::__shared_count()':

Do anyone knows what exactly could be causing this errors been thrown?


I have added #include <tr1/memory> and has sorted the issue.


As of GCC 4.3, you should use:

#include <memory>

... as recommended in the gcc docs.

0

精彩评论

暂无评论...
验证码 换一张
取 消