Posted on 2009-09-16 12:52
heeeey 閱讀(735)
評論(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之前析構(gòu),老外早就有分析了:
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的構(gòu)造函數(shù)中加入 AfxEnableMemoryTracking(FALSE);
機子本來不快,這樣總不至于程序結(jié)束的時候慢死。。。自己寫代碼注意內(nèi)存問題
出現(xiàn)錯誤:
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)”