Compiling and Running the Program

You can compile and execute programs in Genero Studio or use fglcomp, fglform, fglrun command line tools if you prefer.

From Genero Studio

The Execute option in the Genero Studio Project view will compile and link files in the specified application node if necessary before executing the application. You can also compile individual modules or build an application as independent steps.

To compile and execute the simple program in Genero Studio:
  1. In the Project view, expand the BDLTutorial project and find the chap02 group.
  2. Expand the chap02 group and the simple application node. Right-click on the simple configuration node and select Execute.
Figure: Using the Execute option to compile and execute the simple program

This figure shows the Execute option used to compile, link and run the simple application. The program output, "Hello, world!", displays in the Output view.

From the command line

The following tools can be used to compile and execute the simple program from the command line.

  1. Open a terminal / console with Genero enviroment set, to find the command line tools such as fglcomp and fglrun.
  2. Go to the directory where the module is stored, for example, My Documents\My Genero Files\samples\BDLTutorial\chap02\simple.
  3. Check the locale settings before compiling your source code. To support all possible languages, you want to use UTF-8 character encoding with character length semantics:
    fglrun -i
    Charmap      : UTF-8
    Multibyte    : yes
    Stateless    : yes
    Length Semantics : CHAR
  4. Compile the module program, to produce the pcode file simple.42m:
    fglcomp simple.4gl
  5. Execute the program with fglrun, passing the pcode file as parameter:
    fglrun simple.42m
Tip:
By default, if a source file contains an error, fglcomp will produce a filename.err file. Use the -M option with fglcomp, in order to print errors to the standard error stream:
fglcomp -M simple.4gl

You can compile and run a program with a single command, by chaining the commands with the && shell directive:

fglcomp -M simple.4gl && fglrun simple.42m