Game Development Community

custom project class

by Nicolas Buquet · in Torque 3D Professional · 10/15/2009 (6:57 am) · 2 replies

Hi,

I have a problem compiling on XCode 3 (not tested in Visual Studio).

I implemented in TGE and TGEA the tickableScriptObject (www.garagegames.com/community/resources/view/9584) by adding it directly into "console/simObject.cpp" or "console/simBase.cpp".

I did the same successfully in T3D 1.0.

But now, I want to implement it not in the T3D base, but as a new object in one project.

So, from a clean T3D new project, I created 2 new files in the "source" directory : "tickableScriptObject.h/.cpp".

I included the correct headers (it seems…)

// tickableScriptObject.h

#include "core/iTickable.h"
//#include "console/consoleTypes.h"
#include "console/simObject.h"

// TickableScriptObject - JM 
class TickableScriptObject : public SimObject, public virtual ITickable
...

// tickableScriptObject.cpp

#include "tickableScriptObject.h"

#include "console/consoleTypes.h"

IMPLEMENT_CONOBJECT(TickableScriptObject);

void TickableScriptObject::initPersistFields()
{
...

It compiles fine (no error), but doesn't link right. I get 62 errors !

Quote:
"SimObject::setLocked(bool)", referenced from:
vtable for TickableScriptObjectin tickableScriptObject.o
"typeinfo for ITickable", referenced from:
typeinfo for TickableScriptObjectin tickableScriptObject.o
"ITickable::~ITickable()", referenced from:
TickableScriptObject::~TickableScriptObject()in tickableScriptObject.o
"PlatformAssert::processAssert(PlatformAssert::Type, char const*, unsigned int, char const*)", referenced from:
cTickableScriptObjectsetTickRatecaster(SimObject*, int, char const**)in tickableScriptObject.o

It seems to me that I don't configure correctly the link phase, as if the local project doesn't have access to the bundle content.

I tried to add the bundle to the "link Binary wit hLibraries" phase, but without any success (and even another error : unexpected file type 'wrapper.cfbundle').

Does someone see what is wrong in my setup ?

Thanks in advance.

Nicolas Buquet
www.buquet-net.com/cv/


#1
10/15/2009 (12:12 pm)
likely the compilation / Linking order isn't fine. As it seems your own class is meant to be compiled / linked last after the core engine itself is through.

As XCode / GCC aren't as smart as the MS side for this kind of stuff you will have to set it yourself.
#2
10/15/2009 (1:38 pm)
Thanks for your suggestion Marc.

in fact, I think that I misunderstood the file hierarchy.

I ask myself how I can link against a bundle that is loaded at runtime, not at compile time.

I was adding my class files in "source" folder in the "myProject" XCode project. With this config, I get the errors at link time.

If I add my class files in the "source" folder in the bundle project that is associated with my project (so in the "myProject bundle" XCode project, in the "source" folder next to the "engine" folder), the compilation of the bundle and the project is fine, because my custom class is compiled in the bundle with the other T3D classes that are used in my custom class.

So I think my error was to use the bad "source" folder : the "source" folder from the project and not the "source" folder from the bundle.

Nicolas Buquet
www.buquet-net.com/cv/