无法用mingw-w64编译智能指针

No way to compile smart pointer with mingw-w64

本文关键字:智能 指针 编译 mingw-w64      更新时间:2023-10-16

我使用的是历时的mingw w64编译器(从2014年4月开始,使用g++ 4.9.0),我无法编译智能指针(包括<memory>头),无论是-std=c++0x还是gnu0x。我总是得到相同的错误:

error: 'shared_ptr' in namespace 'std' does not name a template type

我被告知最新的gcc能够编译它。但这似乎不是我的情况。我错过什么了吗?

删除-ansi编译器标志。对于c++,它相当于-std=c++98。它出现在-std=c++11之后,并且正在覆盖它。std::shared_ptr在c++中不存在