tags:

views:

434

answers:

2

There is a problem compiling Ogre with MFC in debug mode, you get an error because of the MFC macro:

#ifdef _DEBUG
#define new DEBUG_NEW

Which basically clobbers Ogre's debug new -

#define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__)

I'm trying to get MFC+Ogre to run merrily together in DEBUG mode, and I got it to compile with:

#ifdef _DEBUG
#undef new
#endif
Ogre::Root * root = OGRE_NEW Ogre::Root( pluginsFile, "ogre.cfg", "Ogre.log" );
#ifdef _DEBUG
#define new DEBUG_NEW
#endif

But now, I get a runtime error: Ogre::InternalErrorException

Anybody else face/solve this problem?

A: 

You may need to remove the MFC debug macro rather than the Ogre one. Check this article on the Ogre Wiki here titled Common Mistakes Ogre Wiki

Steve Obbayi
hmm. I know about this, but I was hoping to compile and run, allowing Ogre to use its memory allocation functions and MFC to use its own memory allocation functions
bobobobo
maybe i can try simulate the scenario you have and see what i get on my end
Steve Obbayi
A: 

I think this might be a problem in the specific machine I was using. I tried this out on another machine, and it seemed to work in debug mode with the #ifdefs #undefs as shown above.

bobobobo