This chapter is preceded by the following considerations:
After every change to the source code, the program must first be recompiled for a program test, then an executable program file must be generated, and then the program must be restarted. The necessary programs compiler, archiver and interpreter have already been introduced in chapters 5.0.1 and 5.0.2.
To compile the sample project, the following commands are alternatively executed in the console:
Syntax: gbc3 [options] [<project directory>] hans@linux:~$ gbc3 $HOME/gui_gnuplot OK hans@linux:~$ gbc3 –all $HOME/gui_gnuplot OK hans@linux:~$ gbc3 -ag $HOME/gui_gnuplot OK hans@linux:~$ cd $HOME/gui_gnuplot hans@linux:~/gui_gnuplot$ gbc3 --all OK hans@linux:~$ gbc3 -agv $HOME/gui_gnuplot # Extensive comments and information OK hans@linux:~$ gbc3 -agv $HOME/gui_gnuplot > gui_gnuplot.log
If the compilation was successful, OK is returned as a confirmation and there is a new hidden folder. gambas in the project folder or the content is overwritten. This folder contains files with the file names of the files in the. src folder - here FMAIN and MTERMINAL (in capital letters).
If an error occurs during compilation, a note is displayed with a reference to the line in which the error occurred:
hans@linux:~$ gbc3 -ag $HOME/gui_gnuplot FMain.class:58: error: Unknown identifier: En hans@linux:~$
Here it was a simple clerical error: En dif instead of Endif. Even in case of an error, a hidden - but empty - folder . gambas is created in the project folder. This is not critical, since the contents of the folder are overwritten during a further, error-free compilation run.
Only if the project has been compiled successfully, the executable file gui_gnuplot. gambas or an update will be created in a further step by the program Archiver in the project folder.
Syntax: gba3 [options] [<project directory>]
No acknowledgement is issued if the generation of the executable file was successful. The executable file (archive file) is given the project name (default) and file extension gambas. These commands generate an executable file:
hans@linux:~$ gba3 $HOME/gui_gnuplot hans@linux:~$ cd $HOME/gui_gnuplot # Alternative hans@linux:~/gui_gnuplot$ gba3 If you want to give the executable file a different file name, then you must use the following synatx: hans@linux:~$ gba --output=ZIEL QUELLE hans@linux:~$ gba3 --output=$HOME/gui_gnuplot/gnuplot44.gambas $HOME/gui_gnuplot hans@linux:~$ gba3 -o $HOME/gui_gnuplot/gnuplot44.gambas $HOME/gui_gnuplot hans@linux:~$ cd $HOME/gui_gnuplot # Alternative hans@linux:~/gui_gnuplot$ gba3 -o $HOME/gui_gnuplot/gnuplot44.gambas
Excursion
If you set the -x option, you can display the contents of selected files in the Gambas archive - if the file exists in the Gambas archive:
Syntax: gba3 -x <archive-path> <file>
This call was successful:
hans@linux:~$ gba3 -x $HOME/gui_gnuplot/gui_gnuplot.gambas .project # Gambas Project File 3.0 # Compiled with Gambas 3.3.4 Title=GnuPlot & Process Startup=FMain Icon=Symbols/projekt_icon.png Version=0.0.78 Component=gb.image .. Authors="Dr. Hans Lehmann ~ Osterburg ~ 2014" TabSize=2 SourcePath=/home/hans/Desktop hans@linux:~$ In this case, too, the result is clear: hans@linux:~$ gba3 -x $HOME/gui_gnuplot/gui_gnuplot.gambas .settings gba: file not found in archive hans@linux:~$
To execute the file projektname. gambas or neu_name. gambas you need the interpreter gbx3, which must be installed on the system. The archive file is marked as a script with the' Magic Header' #! /usr/bin/gbr3' and shows Linux how to execute the script. Linux executes the script by calling the interpreter specified in the header:
Syntax: gbx3 [options] [<project-file>] [--<list of arguments: arg_1 arg_2 … arg_k>]
By default, gui_gnuplot. gambas is searched for and - if available - started by the interpreter; otherwise the path to the archive file must be specified and the symbolic link to the interpreter must be used:
hans@linux:~$ gbx3 $HOME/gui_gnuplot ' Standard projectname.gambas hans@linux:~$ gbr3 $HOME/gui_gnuplot/gnuplot44.gambas ' Changed name of the archive file
A separate chapter is dedicated to starting gambas programs with parameters: 5.3.3' Programs with parameters'.
Here you can find the Compile, Archive and Interpret actions for the sample project in the $HOME/gui_gnuplot directory in a tried and tested summary:
hans@linux:~$ gbc3 -ag $HOME/gui_gnuplot OK hans@linux:~$ gba3 $HOME/gui_gnuplot hans@linux:~$ gbx3 $HOME/gui_gnuplot
The result is impressive: