Compiling and executing programs on the command line

This page describes how to compile and execute programs using SeeC on the command line. If you are using SeeC to edit a program comprised of a single source code file, on either Linux or Windows, you can also compile and execute your program directly from the source code editor (via the Project menu).

Compiling programs with SeeC is achieved using the seec-cc program. seec-cc is a slightly modified version of the clang compiler driver, which is itself designed to act as a "drop in" replacement for cc. Thus if you are familiar with using cc (or gcc, clang), using seec-cc should be straightforward.

Note that the screenshots in this guide were taken on a Linux system, but the use and behaviour of seec-cc should be identical on OS X or Windows.


We can compile a single C99 source code file into an executable program as follows:
seec-cc -std=c99 -o <output filename> <input filename>
If the compilation is successful then an executable file will be generated. In the following image we can see that the executable file hello is generated by compiling hello.c:

Compiling a C99 source code file to a program

In general, seec-cc should handle the same options as the cc driver. For example, we can enable many warnings using -Wall, treat warnings as errors using -Werror, and warn about language extensions using -pedantic:

Compiling with additional options

We execute the compiled program just as we would expect:

Executing the compiled program

However, two additional things happen when we execute a program compiled by seec-cc: the program's execution is recorded into an execution trace, and the program automatically checks for runtime errors. In the following image we can see what happens when a runtime error is detected: the program prints a description of the error and the location of the source code responsible for the error. The program's execution is terminated.

Detecting a runtime error during execution

The error is also stored in the execution trace. This is useful for debugging more complicated errors, because the execution trace contains information about everything that occurred during the program's execution (and thus everything that may have contributed to the error). In the image below we can see the execution trace hello.seec:

The execution trace file

Viewing execution traces provides information about viewing such execution traces.