◄ Back to index

GTC Command-line options

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.


Basic usage



Invocation


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.


Adding options


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.


List of all options



Options affecting output



-o switch


By 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 switch


By default, calculator executables are stored in the main folder. You can store them in the folder somefold with the switch --folder=somefold.


--output switch


By 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().


Preprocessor options



-I switch


The -I folder (or -Ifolder) switch tells GTC to look for include files not only in the current directory, but also in the folder folder. You can use this switch several times to include several folders.


-D switch


The -D SYMBOL (or -DSYMBOL) switch tells GTC to #define the symbol SYMBOL, with no specific value. The -D SYMBOL=value (or -DSYMBOL=value) switch tells GTC to #define the symbol SYMBOL, with the value value. You can use this switch several times to define several symbols.


Optimization options


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 switch


This 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.


-mno-bss switch


This switch disables the creation of BSS sections. In some cases it has absolutely no effect, in other cases it will either make the program faster and smaller, or make it much larger (if you are using large global arrays).


Other options



-- separator


Not 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.