Page 1 of 1

Memory leaks when include ogre.h in mfc?

Posted: Tue Feb 01, 2005 9:37 pm
by Newton1976
Hi,

first sorry for my bad english.

i cant find a solution about my problem in this forum:

why have i memory leaks when including the ogre.h in a standard mfc application (for example a dialog-based mfc application).

including the ogre.h in a "normal" win32-based application cause no problems.

i using Visual Studio.Net 2003.

thanks for your patience

Newton1976

Posted: Tue Feb 01, 2005 10:09 pm
by sinbad
Try surrounding your MFC includes with:

Code: Select all

#include "OgreNoMemoryMacros.h"
.. MFC
#include "OgreMemoryMacros.h"
I never use MFC but I believe it's one of those things that doesn't like to co-exist with the memory manager.

Posted: Wed Feb 02, 2005 10:03 am
by Newton1976
undefining alloc/free/new/delete functions does not function also.

mfc does not like overwriting this functions.

Any other suggestions?

Posted: Wed Feb 02, 2005 2:46 pm
by sinbad
This should work - take a look at ogreaddons/MeshViewer which uses MFC happily with Ogre.

Posted: Fri Feb 04, 2005 8:37 am
by Newton1976
:D Thanks for your help :-)

Posted: Fri Feb 04, 2005 5:08 pm
by johnhpus
Just to avoid confusion ... if it hasn't changed the mesh viewer uses WTL instead of MFC.

If your familiar with MFC you can also check out the wxWidgets tutorial that comes with Ogre and work from there. It shows you what you need to do, but it's up to you to figure out where to do that in an MFC app.

Good luck,
John