Game Development Community

Namespace linkage problem

by Leo Willman · in RTS Starter Kit · 11/18/2005 (7:01 am) · 2 replies

We are using the RTS-kit to make a RTS game and have declared our own unit class that inherits from RTSUnit. We also have a class UnitData that inherits from RTSUnitData like this:
// Unit.h
class UnitData: public RTSUnitData
{
  private:
    typedef RTSUnitData Parent;
  public:
    //...
    DECLARE_CONOBJECT( UnitData );
};

// Unit.cc
IMPLEMENT_CO_DATABLOCK_V1( UnitData );

On startup we get the following error at the top of the console:
Error: cannot change namespace parent linkage for UnitData from SimObject to RTSUnitData.

I can't figure out why this error occures. Any ideas? Thanks!

#1
11/19/2005 (4:19 pm)
Check to make sure that there isn't an object "UnitData" already defined within the namespace.

Change the name to ModUnitData or something else, or just do a happy slappy find in files.

Seems to have issues with casting back from RTSUnitData lineage.
#2
11/21/2005 (5:56 am)
Well, now I feel really stupid :P
I did check for another object named UnitData before posting but now when I did follow your advice to change the name of it I found the second definition in the first file I checked. Thanks Tom!