无法用mingw-w64编译智能指针
No way to compile smart pointer with mingw-w64
我使用的是历时的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++中不存在
相关文章:
- 1d 智能指针不适用于语法 (*)++
- 优先顺序:智能指针和类析构函数
- 对于C++中使用智能指针的指针算术限制,有没有一种变通方法
- 智能指针作为无序映射键,并通过引用进行比较
- 智能指针概念所有权和寿命
- 正在理解智能指针,但出现错误:未分配正在释放的指针
- 尝试使用智能指针时引发异常
- 我可以制作指向智能指针的智能指针吗?
- 通过智能指针和转换对基本模板参数进行模板推导
- OpenCV 我应该使用智能指针来防止内存泄漏吗?
- 从堆栈分配的原始指针构造智能指针
- 初始化指向类实例的智能指针并访问其方法
- 如何使用 std::make_shared 创建基类类型的智能指针?
- 给定一个指向堆分配内存的指针,智能指针实现如何为其找到合适的释放函数?
- 编译器不会使用 -std=c++11 编译智能指针
- 具有智能指针的多态性
- C++:矢量分配器行为、内存分配和智能指针
- 在什么情况下,需要共享智能指针而无法使用唯一指针?
- 指向函数签名中的常量智能指针
- 使用智能指针附加的继承对象的深层复制