Bitmap
Bitmap

Reputation: 12538

include tr1::shared_ptr

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 been 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?

Upvotes: 5

Views: 10181

Answers (2)

Michael Goldshteyn
Michael Goldshteyn

Reputation: 74410

As of GCC 4.3, you should use:

#include <memory>

... as recommended in the gcc docs.

Upvotes: 5

Bitmap
Bitmap

Reputation: 12538

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

Upvotes: 8

Related Questions