Page 1 of 1

Conflicts between Ogre and third party libs...

Posted: Sun Jan 30, 2005 4:34 pm
by katskos
I am trying to compile an Ogre project in VS .NET 2003 combined with
Ruby as a script language. I get strange errors during compile. I have
managed to explain those errors and can't find a way out.
Let me give you an examle:

a typical error is this:
ogreroot.h(387): error C2059: syntax error : ')'
the line in question is this: void shutdown(void);

The reason for the above is this:
When i include Ruby.h before any ogre headers i get the above error
because ruby defines a shutdown macro in win32.h. So the compiler
considers shutdown as a macro.

If i include ruby.h after any ogre headers i get other kinds of errors
considering memory management functions.
e.g. Ogre defines calloc as a macro while ruby.h includes malloc.h
and declares calloc as function prototype and i get erros again.

Does anybody know a smart tactic or any advice to solve the above?
There must be a solution for all of this.
I wouldn't want to shutdown Ogre's memory management.

Thanks in advance.

Posted: Sun Jan 30, 2005 4:53 pm
by haffax
katsakos, we have the same problem using ruby as our scripting language. We us an include file, that we include after including "ruby.h".

You can find it here.
This is how we use it:

Code: Select all

#include <OgreNoMemoryMacros.h>
#include <ruby.h>
#include "FixRubyHeaders.h"
#include <OgreMemoryMacros.h>
I don't know if this is smart or elegant but it works. :)

Posted: Mon Jan 31, 2005 4:30 pm
by katskos
Thanks alot. :D This seems elegant to me.