Next: Compiler errors, Up: Compiling Executing
Here are the commands for building and using an Ada project, as listed in the Ada menu.
In multi-file projects, there must be one file that is the main
program. That is given by the main
project file variable;
it defaults to the current file if not yet set, but is also set by the
“set main and build” command.
Check file
check_cmd
defined in the current project file. This typically
runs faster than full compile mode, speeding up finding and fixing
compilation errors.
This sets main
only if it has not been set yet.
Compile file
comp_cmd
from the current
project file.
This does not set main
.
Set main and Build
main
to the current file, then executes the Build
command.
Show main
main
in the message buffer.
Build
main
, and links
main
, by running make_cmd
from the current project.
This sets main
only if it has not been set yet.
Run
run_cmd
from the current project. The
execution buffer allows for interactive input/output.
To modify the run command, in particular to provide or change the command line arguments, type C-u before invoking the command.
This command is not available for a cross-compilation toolchain.
main
is used and changed.
Build runs 'gnatmake' on the main unit. During a typical edit/compile session, this is the only command you need to invoke, which is why it is bound to C-c C-c. It will compile all files needed by the main unit, and display compilation errors in any of them.
Note that Build can be invoked from any Ada buffer; typically you will be fixing errors in files other than the main, but you don't have to switch back to the main to invoke the compiler again.
Novices and students typically work on single-file Ada projects. In this case, C-c C-m will normally be the only command needed; it will build the current file, rather than the last-built main.
There are three ways to change main
:
main
to
the current file.
main
and
main
, and click ‘[save]’
main