Game Development Community

When i start example error:"failed to open main.cs"

by Andy "Doomed Toast" Verstraeten · in Technical Issues · 02/07/2005 (2:18 am) · 12 replies

Hi i seem to be having a litlle bit of trouble i'm running knoppix and torque.First it wouldn't execute the install binary but after some system configuration it went like a charm and installed but when i tried to execute the example file it ran but it gave the following errors "failed to open main.cs" and the "failed initialize game,shutting down".
I checked and main.cs is in place and the example binary has read and write privileges.
So if any of you have and idea on how to make it work all help is welcome.Thank you

About the author

Recent Threads


#1
02/07/2005 (2:23 am)
This is the TGE saying that it cannot find the "main.cs" which is nearly always caused by the fact that the executable is not being run in the same current directory as the root "main.cs" file. This is not the same as the files being in the same directory so be careful.

- Melv.
#2
02/07/2005 (2:25 am)
These are similar problems, all caused by the current directory problem ... "Cannot find main.cs".
#3
02/08/2005 (5:14 am)
All these things reffer to visual studio but how do i fix it on linux
#4
02/08/2005 (6:18 am)
I don't know how to fix your problem on Linux; I gave you hints as to why it might be happening. If I knew what your problem was I'd say.

Did you read my post where I said it probably has something to do with a current directory problem? I never said it was visual studio.

- Melv.
#5
02/08/2005 (12:08 pm)
Two things:
1) cd torque-dir/example; ./torque.bin

Note the "./" prefix on torque.bin

2) Try using the runtorque.sh script instead.

Gary (-;

PS Just a warning, runtorque has an irritating bug. It uses $* instead of "$@" [yes, with the quotes]. That means that
./runtorque.sh "One" "Two Three"
will run torque with three arguments "One" "Two" "Three" instead of two, "One" "Two Three".
#6
02/08/2005 (12:34 pm)
A couple more things in addition to Gary's suggestions:
- you can add . (current dir) to your path
ex: set path = ( . $HOME/bin $HOME/scripts )
- you can create an alias
#7
02/08/2005 (2:32 pm)
Hmmm. I would make a humble recommendation here:

Never, EVER, add "." to your current path, especially at the start of it. On DOS this is moot, but on genuine multi-user systems [eg, all unices], this is a catastrophically daft security hole.

A malicious user can create a script in /tmp [for example], called "ls". I imagine you can see where I'm going from here.

In the script, they could run anything they want, including detecting if you're root and mailing /etc/shadow to themselves, or creating a setuid root shell, or... or... or...

All the innocent victim has to do is go into /tmp [not uncommon] and run "ls" [even less uncommon], and their account is compromised.

Gary (-;

PS As an aside, If you need to tell a user how to prefix "." to their path, then they're probably running bash or another bourne, which is the default on most unices other than OSX; better instructions for people who don't know this might be:
PATH=.:$PATH; export PATH

EDIT: PPS As another aside, I think I've just remembered that prefixing "." to the PATH doesn't even fix this problem.
#8
02/08/2005 (5:18 pm)
YMMV, RTFM, STFW, etc.
#9
06/05/2005 (8:40 pm)
I think I may have just isolated the source of this problem. At least the OS X (I'm not sure if you guys are aware this happens to OS X users too) side of it anyway.

Lets say your Torque2D folder lies in a hierarchy like this
Internal HD/Developer/™ Problem Folder/Torqe2D SDK 1.0.2/example/T2D-OSX

Every single time the T2D application starts up, it will be completely unable to find main.cs, regardless of it actually being in the right spot. If you remove the symbol from the folder "™ Problem Folder" everything works fine.

I've tested a couple other extended characters ( ™ ¢ ¡ § ¶ £ ) and they all cause the same problem. Also, putting a forward slash ( ⁄ ) in the name of a folder results in the application bouncing once in the dock, and then exiting without an error message at all.

Edit: Ugh, these forums don't allow html tags, so I'm not sure how I can show you the symbols that cause problems.
Basically on OS X, any special symbol that requires holding down the option key to type it will break Torque2D (and most likely Torque itself) just by being being part of a name of an ancestor folder.
#10
05/21/2006 (6:16 pm)
Problem with main.cs not loading try a different distro of linux like slackware make sure all drivers are installed and then if needed type this in terminal export LD_PRELOAD=the path to libGL.so usaly in /usr/lib i had that same problem and now it works fine after doing that
#11
05/21/2006 (6:21 pm)
Problem with main.cs not loading try a different distro of linux like slackware make sure all drivers are installed and then if needed type this in terminal export LD_PRELOAD=the path to libGL.so usaly in /usr/lib i had that same problem and now it works fine after doing that
#12
05/22/2006 (9:07 am)
On ubuntu :

cd ../example

$ echo $PATH
.:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
$ ls
common
show
console.log
lib
creator
main.cs
starter.fps
runtorque.sh
torqueDemo.bin

$ runtorque.sh

In this context it works