Ogre与MFC结合时的内存泄漏问题

4 篇文章 0 订阅

参考:
      http://www.blogjava.net/wangle/archive/2008/11/18/124813.html
      http://lyodev.appspot.com/2009/08/and-mfc-memory-leak-ogre16-conflict

第一步,是卸载dll先后顺序的问题,让OgreMain_d.dll在mfc80d.dll之前析构,老外早就有分析了:
 i) in the General tab, switch "Use MFC in a shared DLL" to "Use Standard Windows Libraries"
 ii) in the C/C++/Preprocessor tab, add _AFXDLL to the preprocessor definitions
 iii) in the Linker/Input tab, add mfc90ud.lib anywhere before OgreMain_d.lib
 
第二步,删除自己代码中的所有的#defin new DEBUG_NEW,然后在 CApp的构造函数中加入 AfxEnableMemoryTracking(FALSE);


机子本来不快,这样总不至于程序结束的时候慢死。。。自己写代码注意内存问题



出现错误:

1>Compiling...
1>stdafx.cpp
1>d:/program files/microsoft visual studio 9.0/vc/atlmfc/include/afxver_.h(81) : fatal error C1189: #error :  Please use the /MD switch for _AFXDLL builds

解决方法:
    c/c++ ---- Code Generation  --------- runtime library 改为 “Multi-threaded Debug DLL (/MDd)”
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值