错误:'bad_alloc' : is not a member of 'stlp_std'
来源:互联网 发布:光猪圈健身怎么样 知乎 编辑:程序博客网 时间:2024/04/30 00:50
用ATL实现一个COM时发现编译错误:
'bad_alloc' : is not a member of 'stlp_std'
去除所有代码,找到有问题的代码行。
最后可用一行代码重现错误:
#include <new> // for std::bad_alloc
...
throw std::bad_alloc();
禁用STLPort库而使用VC6的原生stl库,没有错误,但有个警告:
warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify -GX
问题看来一定是GX编译开关了。
ATL默认不打开异常处理,不过用到stl就必须打开。
看来ATL不鼓励使用stl,甚至要少用CRT,目的是生成最小的目标模块。
参考:
[1] ATL里用STL
[2] 使用STL类在ATL com中的问题
(转载请注明来源于金庆的专栏)
- 错误:'bad_alloc' : is not a member of 'stlp_std'
- rapidsvn 编译错误: OnOK is not a member of CheckoutDlg
- Qt 解决“is not a member of ‘std’”错误
- c++ 编译错误is not a static member of ...
- Qt编译错误: 'UnicodeUTF8' is not a member of 'QApplication'
- 'daemonize' is not a member of 'ACE'
- 'GetCurSel' : is not a member of 'CTime'
- is not a member of global namespace
- 'WriteHuge' : is not a member of 'CFile'
- 'find_if’ is not a member of ‘std'
- 'SetWindowTextA' : is not a member of 'CString'
- 'numeric_limits' is not a member of 'std'|
- 'numeric_limits' is not a member of 'std'
- 'putText' is not a member of 'cv'
- '_file': is not a member of '_iobuf'
- shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std' 错误修正
- 继承QTreeWidgetItem发生error: 'staticMetaObject' is not a member of 'QTreeWidgetItem' 错误
- 继承QTreeWidgetItem发生error: 'staticMetaObject' is not a member of 'QTreeWidgetItem' 错误
- SubVersion代码库的回滚
- 基于C#实现用于显示照片的屏保
- 第一次在CSDN上写文章
- JDBC 入门
- Java数据对象(JDO)的应用
- 错误:'bad_alloc' : is not a member of 'stlp_std'
- Send and Move to SDCard
- DECLARE_SERIAL/IMPLEMENT_SERIAL宏
- 以亲身经验列举恶性网站
- 真是很久没写博客了,感谢一下赢在中国
- 观察者模式---C#中的事件
- 在网络公司还有未来吗?
- 关于爱情和亲情的小故事
- C#播放MP3的类