Posted on 2009-09-16 12:52
heeeey 阅读(732)
评论(0) 编辑 收藏 引用 所属分类:
ogre
参考:
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)”