Game Development Community

Trouble compiling T2D

by Christian Armeanu · in Torque Game Builder · 08/05/2005 (10:07 am) · 11 replies

Hi,

I just got Torque2D a few days ago and am trying to compile the engine, but unfortunately I don't seem to be able compile successfully ... not using GCC3 on Windows XP Pro, and not using MS Visual Studio for C++ Express 2005.
MSVC breaks due to an error with the resource compilation, complaining about the LANGUAGE ID and not being able to find the T2D icon file (very strange! I tried everything I can think of, including specifying the full path!) in resource.h, and GCC3 delivers the result below:

C:\Torque2D\SDK>make
--> Compiling audio/audio.cc
In file included from ./audio/audioBuffer.h:16,
from ./audio/audioDataBlock.h:13,
from ./audio/audio.h:13,
from audio/audio.cc:6:
./core/resManager.h: In member function 'void Resource::unlock()':
./core/resManager.h:255: error: invalid use of undefined type 'struct ResManager'
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
./core/resManager.h: In member function 'void Resource::purge()':
./core/resManager.h:263: error: invalid use of undefined type 'struct ResManager'
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
./core/resManager.h:265: error: invalid use of undefined type 'struct ResManager'
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
./core/resManager.h: In member function 'void Resource::_unlock()':
./core/resManager.h:278: error: invalid use of undefined type 'struct ResManager'
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
audio/audio.cc: In function 'int loopingImageSort(const void*, const void*)':
audio/audio.cc:161: warning: converting to 'int' from 'float'
audio/audio.cc: In function 'int streamingSourceSort(const void*, const void*)':
audio/audio.cc:193: warning: converting to 'int' from 'float'
audio/audio.cc: In function 'AUDIOHANDLE alxCreateSource(const Audio::Description*, const char*, const MatrixF*, AudioSampleEnvironm
ent*)':
audio/audio.cc:707: warning: converting to non-pointer type 'ALuint' from NULL
audio/audio.cc: In function 'ALuint alxGetWaveLen(ALuint)':
audio/audio.cc:2092: warning: converting to 'ALuint' from 'F64'
make[1]: *** [out.GCC3.RELEASE/audio/audio.obj] Error 1
make: *** [default] Error 2

Any help is highly appreciated!!!

Thanks,
Chris

#1
08/05/2005 (12:02 pm)
With ms visual studio 2003 i was able to compile using the workspace in the vc6 folder
#2
08/07/2005 (10:37 am)
I had no luck with that either ... with the VC6 project files it breaks because of multiple ResManager redefinitions. I didn't have time to have a closer look, but I'll try to do so tomorrow.
#3
08/07/2005 (1:02 pm)
Are you using TBE (Torque Build Environment) / Eclipse IDE ? It's in the resources I believe.
That was the only way I got it to build. I turned off warnings too because there were quite a few of them.
#4
08/09/2005 (11:01 am)
No, but I use the same tools however ;-)
MinGW and MSys with GCC 3.4.2:

Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug

Thread model: win32

As of ResManager.cc/.h ... I don't seem to find anything wrong there either!?! Am I really the only one with this results? Is there maybe another version to download (GCC and/or T2D) that works, or am I just cursed with blindness?

Thanks,
Chris
#5
08/09/2005 (12:42 pm)
Yes I use the same tools too, have for years. Yet for some reason it only compiled with TBE. I hope they'll make it build with newer versions of GCC, but for now I'm just using "whatever works" aka TBE.
It comes with older versions of Mingw and Msys and the Eclipse IDE, preconfigured for the most part although you'll need to edit the project for T2D (by default it's setup for Torque3D).
I can try to help you if you run into trouble, I have it working here...
#6
08/10/2005 (12:47 pm)
Greetings.

I have a related question. The website here basically implies you need some sort of compiler to make your projects. Well, that's just common sense. Even game engines that have their own IDEs often expect you to tell them what compiler you want them to use to actually build your game executables. No problem says I, since I use VC 6 and Borland's C Builder 6. So I buy the Torque 2d SDK and fire up the tutorial. When a naive gentleman such as myself reads the basic tutorial that explains how to make the space shooter, it sounds to me as if all that is required to make a game is to edit the client.cs file. So of course I start to edit this file and naturally nothing happens when I try to run the T2D.exe file in the example directory. So obviously there is compiling involved. But where? Even the "Hello World" example from another thread is written exactly as if all you need to do is fill up cs files with your own scripts using any text editor. Where can I find the explanation of "Start your compiler's IDE and make a new project... include such-and-such files... make sure you include such-and-such libraries..." and so forth? I did open up the dsw under the VC 6 folder and tried to compile it, getting this linker error:

LINK : fatal error LNK1104: cannot open file "\Torque2D\SDK\lib\out.VC6.RELEASE\glu2d3d.lib"

A quick search reveals that glu2d3d.lib apparently does not come with the Torque SDK. So can I delete this reference, or was I supposed to download some other SDK as well as T2D? More things that the documentation neglects to mention. And looking at the workspace for this dsw, I don't see any cs files listed anywhere. So how do they fit in? I do have to tip my hat to the collective group here, as many people seem to be immediately up and running despite these documentation omissions. So am I only supposed to be text editing cs files to make a game, or what? And if I have to compile, what exactly am I supposed to be compiling?
#7
08/10/2005 (4:05 pm)
You can easily make a full 2D game without ever having to compile the C engine source yourself. All of Torque2D's features are exposed into the Torquescript you've seen in the tutorial and the Hello World examples. Just make sure you're editing the files in the right place; the files that represent the spacescroller demo are all in the spacescroller subdirectory for example but you need to launch the runshooter.bat file to activate it. If you look inside the runshooter.bat file you'll see that it treats the spacescroller directory as a mod and loads it as such. By default the t2d.exe executable in the example directory runs the particle/tile/gui editors which are inside the T2D directory (the 'main' game files).

You'll probably want to duplicate the spacescroller directory, name it something different and launch it similar to how the runshooter.bat is running the spacescroller (which is to say "t2d.exe -mod ")

You'll only want/need to actually compile the C engine source if you need to change or extend the core functionality of the engine beyond what is feasible or reasonable to do in script (and you can do a LOT in script). glu2d3d.lib is part of the "t2d sdk.dsw" workspace, it should have compiled as part of the project when you build. Try building that project by itself and see why it isn't working.
#8
08/10/2005 (11:09 pm)
Right you don't need a compiler to use T2D. I'm adding Lua scripting right now, and I plan to do other things like remove some bloat (gif,jpeg,extra functions etc). Otherwise I'd code all in .cs files. If you don't know C++ you really should stick to the .cs files. There are IDE's made just for TorqueScript too with syntax highlighting and all that good stuff. I forget the links but they're around here somewhere.

So yes, editing client.cs from the /T2D folder will allow you to start hacking. I suggest you go thru the .PDF tutorial in the SDK's doc directory. That glu2d3d lib I'm not sure about. I can't get it to build yet so I just drop the precompiled DLLs in the same directory as T2D.exe, which seems to work.
#9
08/11/2005 (2:00 pm)
Hey,

I got tired of trying to get the GCC compile process to work and extended the configuration with a VCExpress 2003 setup instead.

It compiles and works just fine ... and is free ;-)

If anybody is interested in this, please let me know and I'll post the files and necessary changes.
Oh, it is still based on make, not the MS nmake and can be configured using make -f mk/configure.mk ...

Maybe GG could add this to their distro ...

Cheers,
Chris
#10
08/11/2005 (9:07 pm)
To each his own ;) Glad to see that you're up and running.
#11
08/12/2005 (8:27 am)
@Joe Rossi: Thank you for your support! I still use Eclipse (MyEclipse respectively) for most of my development tasks, and hope that MSVC support will soon be integrated in CDT, but as of now, the VC 2003 Toolkit seems to be the better solution with TGE/T2D, at least for me. It is a fully optimizing compiler and integrates all the extra bling bling to compile for windows ... besides that it does work with T2D and TGE for me ;-)

@Melv, if you happen to read this, could you please post the code for your gun turret active tile? Since you did it already, I don't feel like reinventing the wheel ... mmh ... well, the turret :o)

Cheers,
Chris