我想玩转 C++11 的新特性,即Smart Pointers
. 我在这里找到了一个 exampleg++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2:Cplusplus11-Smart-Pointers:
#include <memory>
int main() {
std::shared_ptr<int> sptr1( new int );
}
当我尝试时,我得到的就是:
In function ‘int main()’:|
error: ‘shared_ptr’ was not declared in this scope|
error: expected primary-expression before ‘int’|
error: expected ‘;’ before ‘int’|
这是我的 g++ 版本:
g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
我是否必须首先“激活”C++11?