The computer version of GTC has a number of options available on the command-line. They are all listed here.
Please note that currently, these options are not available for the FlashApp version.
To compile a file named hello.c
, open a command-line prompt in the folder where hello.c
is stored, and type:
gtc hello.c
This will create files named hello.89z
, hello.9xz
and hello.v2z
(or only some of those, if your program is specific to a calculator model). You can now run them after sending them to your calculator or to an emulator.
You can modify the behaviour of GTC with command-line options (or command-line switches). Their position on the command-line does not matter. For example, if you want to use the -o
switch to create files named somename.89z
, somename.9xz
and somename.v2z
, you can type:
gtc hello.c -o somename
Or, equivalently:
gtc -o somename hello.c
See below for a complete list of options.
-o
switchBy default, gtc hello.c foo.c bar.c
results in an executable named hello.89z
or hello.v2z
. You can specify other names with this switch, for example gtc hello.c foo.c bar.c -o somename
will instead create an executable named somename.89z
or somename.v2z
.
--folder
switchBy default, calculator executables are stored in the main
folder. You can store them in the folder somefold
with the switch --folder=somefold
.
--output
switchBy default, gtc hello.c -o somename
results in an executable named somename.89z
; the name of the program on the calculator will thus be somename()
. You can change this with the switch --output=myprog
: gtc hello.c -o somename --output=myprog
creates an executable named somename.89z
containing a program whose name on the calculator will be myprog()
.
It is in the philosophy of GTC to have default options as sensible as possible, so optimization options are kept to a bare minimum. Furthermore, optimizations are always enabled.
-exe
switchThis switch will make your program much smaller and very slightly faster, at the expense of a short loading time (usually less than half a second). However note that because it adds an unpacker to your program, it will make very small programs (less than 3-4 kilobytes) larger, so it should not be used in this case. It has the same effect as defining the EXE_OUT
preprocessor symbol.
It can be an interesting way to work around AMS's program size limit for AMS version 2.0x, because a program that exceeds the size limit when uncompressed can be compressed to a size below the limit.
--
separatorNot an option per se, but a way to indicate that all arguments after --
are really filenames and not command-line switches.
For example gtc -DHELLO hello.c -- foo.c -file-with-dashes-.c
will compile the 3 files hello.c
, foo.c
and -file-with-dashes-.c
, with the single option -DHELLO
. Without --
the file -file-with-dashes-.c
would have been understood as an (invalid) command-line option.