|
Department of Engineering |
|
|
xcc/xccmake
|
xcc (xccmake is the same program) is a graphical front-end for the C++ compiler (g++). It aims to make common tasks easy. You can start it
by typing its name (followed, optionally, by a folder name or by source filenames), by
clicking on its icon, by dragging one or more source files
onto its icon, or by dragging a folder of source files onto its icon .
|
Buttons
Along the top of the window are several buttons
- Edit - Edits the current document using the specified
editor (by default emacs. but this can be changed using the
EDITOR environmental variable).
- Compile - Compiles the current document. If only one
source file is being used and the source file contains a routine
called "main", an attempt is made to produce a
program. Otherwise the current document
is compiled to the "*.o" stage.
- Make - This button only appears if more than 1 file has
been loaded in. It produces then runs a makefile (whose name is
Makefile.executable_name), attempting to produce an executable
program. For efficiency, only the minimun necessary source files are
recompiled - if nothing's changed, no compilation is done.
- Run - Runs the current compiled program, displaying the
output in the text window of xcc.
- Kill - Kills the currently running program.
You should only need to use this if a mistake in your program means
that stuck in an endless loop.
- Help - Displays a WWW page (the browser and URL are
customisable using the XCCBROWSER and XCCHELPURL
environmental
variables). Default behaviour is to run
"mozilla http://www-h.eng.cam.ac.uk/help/tpl/languages/C++.html".
- Print - Prints the current document on the default
printer if you're in the EIE lab, the Speech Lab, or the DPO. If you're
sat at other machines and the PRINTER variable is set,
output will be sent there.
- Quit - Quits the program, killing all edit sessions
started from the Edit button.
Text Fields
Below the buttons are some text fields. Some of these you can't change
once xcc has started. The editable fields are
- Document - The name of the current source file. Names can
end in ".cc" or ".C". If you have loaded many
source files in, you can change the current document by clicking
on the current document name and selecting an alternative.
- Executable - If there's only one source file, the
executable name is the source file's base name. Otherwise,
xcc scans through the source files looking for a main
routine. If one is found, the executable name
will be the basename of the source file, otherwise "a.out"
is used.
Compilation Behaviour
By default on the HP system the "-AA +DAportable" flags are used, so that the resulting
program can run on as many machines as possible.
On Linux machines, "-ansi -g" are the default switches.
You can add flags by changing the CXXOPTS
environmental variable. For instance, typing "export CXXOPTS=-O"
before typing "start ..." makes the compiler use optimisation.
The files are scanned to see if files are directly included.
If so, the corresponding extra flags and libraries are included. Include
files can be nested to a depth of 4.
The files currently sought are
- glue.h: Glue - adds "-L/usr/local/lib -I/usr/local/include -I/usr/include/GL ... -lglue -lglui -lglut -lGLU -lGL"
- vogle.h: Vogle - adds "-L/usr/local/lib -L/usr/X11R6/lib -I/usr/local/include ...-lvogleextras -lvogle -lX11"
- robot_link.h, robot_instr.h, delay.h, stopwatch.h: 1BRobot - adds "-L/export/teach/1BRobot -I/export/teach/1BRobot ... -lrobot"
- trading.h: 1A Computing - adds "-L/usr/local/lib -I/usr/local/include ... -ltrading"
- gps.h, gps_graphics.h, gps_shared.h: 1BComputing - adds "-L/usr/local/lib -L/usr/local/teach/1BComputing -I/usr/local/teach/1BComputing ... -lgps_graphics -lXpm -lX11"
Execution Behaviour
Just before running a program on HP systems it creates a size 0, read-only
"core"
file in the directory of the program (if "core" doesn't already exist).
This is to stop the creation of large core files.
If an executable that's about to be compiled is running, it's killed
first and the user is informed.
If Control-C or Control-D is typed into the main text window it
will be passed to the running process.
Customisation
- Environmental variables used - EDITOR, PRINTER,
XCCBROWSER , XCCHELPURL.
- X resources - The application name is "Xcc". Resources used are:
"faconneur" (default g++), "editeur" (default emacs),
"inputFont", (default 6x13bold), "outputFont", (default 6x13),
"commandFont" (default 6x13bold), labelFont (default 6x13).
Bugs
If something doesn't work, mail a clear description of the problem to
Tim Love. Known problems are
- The --- Finished --- line may appear before all the program's
output has appeared. This is because even though the program may have
finished, the output it produces takes a while to appear on the screen.
The --- Finished --- message takes a separate route to the
screen and may well get there before all the program's output appears
September 2007 changes
- Spaces in file/folder names allowed
- You can now drop a single folder of source files (a "project folder") onto the icon
- Library/Include paths have changed
December 2007 changes
A configuration file can be used using a -ffilename
flag. The following example shows all the options. The override=yes
option means that the include and library options set in the configuration file will replace (rather than be pre-pended to) the usual options.
# Title: arm.cnf
# --
# XCC Configuration file for the ARM cross compiler
# for use with the IDP robots
linker=arm-linux-gnu-g++
compiler=arm-linux-gnu-g++
override=yes
includeflags=-I/homes/users/d/praf1/librobot
libraryflags=-L/homes/users/d/praf1/librobot
libraries=-lrobot.arm
objectsuffix=arm.o
executablesuffix=arm