Game Development Community

SimObject Subclassing

by Michael Boxleiter · in Torque Game Engine · 08/20/2006 (3:09 pm) · 1 replies

I am trying to create subclasses of SimObject which would store all my game data not directly related to the scene. I have written one subclass of SimObject and four classes which are subclasses of it. The code compiles fine unless I declare my parent subclass to be a conobject ( DECLARE_CONOBJECT(MyClass) and IMPLEMENT_CONOBJECT(MyClass) ) in which case i get LNK2005 errors for all but one subclass of MyClass, and each error says something was already defined by the non-error subclass. I need to be able to refer to these classes from the console and use custom Console Methods.

I'm using visual studio 2003, if that's any help.

Thanks in advance for any advice.

#1
08/21/2006 (5:45 pm)
Ok, I made a stupid mistake. I included the IMPLEMENT_CONOBJECT(MyClass) in the .h and it was duplicated each time my subclasses refrenced it. Oops.

I hate it when people post a question and then in their next post they simply say "Oh, i fixed it", so here was the fix if anyone else has this problem.