Regarding the use of shared_pointers in a c++ program, I have declared the #include <memory>
and then called upon the following std::shared_ptr<int>(new int(5))
it refuses to compile saying that
error: 'shared_ptr' is not a member of 'std'
or alternatively
Symbol 'shared_ptr' could not be resolved
Can anyone tell me why this is happening? from what i read, shared point should be defined in std or boost libraries and i have tried them both
std::shared
is a C++11 feature.
You must have a compiler supporting this.
For example with GCC you should add -std=c++11
or -std=gnu++11
.
If you don't have C++11, you can also use boost::shared_ptr
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.