g++版本低于4.7使用C++11

编译时需要添加:

需要添加头文件#include<memory>

g++ -std=gnu++0x share_ptr.cpp -o s

原文:

C++11 features are available as part of the "mainline" GCC compiler in the trunk of GCC's Subversion repository and in GCC 4.3 and later. To enable C++0x support, add the command-line parameter -std=c++0x to your g++ command line. Or, to enable GNU extensions in addition to C++0x extensions, add -std=gnu++0x to your g++ command line. GCC 4.7 and later support -std=c++11 and -std=gnu++11 as well.

原文地址:https://www.cnblogs.com/practicer/p/3424326.html