Memory leaks when include ogre.h in mfc?

Problems building or running the engine, queries about how to use features etc.
Post Reply
Newton1976
Gnoblar
Posts: 3
Joined: Tue Feb 01, 2005 9:31 pm
Location: Germany - Saarland

Memory leaks when include ogre.h in mfc?

Post 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
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post 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.
Newton1976
Gnoblar
Posts: 3
Joined: Tue Feb 01, 2005 9:31 pm
Location: Germany - Saarland

Post by Newton1976 »

undefining alloc/free/new/delete functions does not function also.

mfc does not like overwriting this functions.

Any other suggestions?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

This should work - take a look at ogreaddons/MeshViewer which uses MFC happily with Ogre.
Newton1976
Gnoblar
Posts: 3
Joined: Tue Feb 01, 2005 9:31 pm
Location: Germany - Saarland

Post by Newton1976 »

:D Thanks for your help :-)
User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
Posts: 1186
Joined: Sat Apr 17, 2004 2:49 am
x 3

Post 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
Post Reply