geany is an IDE (Integrated Development Environment) for C++ (and some other languages). It has an editor and some support for multi-file source code. It uses g++ to compile the code and make to deal with the compilation of multi-file source code. You can start it by typing its name (followed, optionally, by a C++ filename), by clicking on its icon (it's in the Programming section of the Applications taskbar menu), or by dragging a C++ source file onto its icon.
If you drag multiple source files onto the icon (or the opened geany window), the files will be opened in geany's editor, and you may even by able to use the Make all option to create a new executable program, but the Execute button won't work. For CUED's 1ATrading exercise you can fix this by loading the project file in (it's best to start by doing this rather than loading in the individual files). Use the project file that's in the folder where your source files are (it has a .geany suffix).
Full details are in the Manual or geany's Help menu. Here are some details
- If you drag some highlighted text in the editor of Geany, the text is moved to the position where the mouse pointer is when releasing the mouse button. Holding Control when releasing the mouse button will copy the text instead.
- The tabbed panel to the left of the editor offers short-cuts to useful code fragments and files.
- When you press the Compile button, files are automatically saved.
- Compile just compiles (i.e. it produces an intermediate file with a .o suffix, not a runnable program)! Build (in the Build menu) tries to produce a runnable program from a single source file. Make All (in the Build menu) creates a runnable program from multiple source files as long as things have been set up correctly.
- Clicking on an error message makes the editor's cursor go to the appropriate line in the appropriate file.
Behind the scenes, geany uses project files (with a .geany suffix) to specify which files belong to a project, what should happen when the Execute button is pressed, etc. When it executes a file it creates a temporary script called geany_run_script.sh. Here's a typical project file for the 1ATrading project
[project] name=1ATrading base_path=/homes/users/g/tpl/1ATrading/ make_in_base_path=false description= run_cmd=./Trading [files] current_page=2 FILE_NAME_0=0;1;0;16;1;1;0;/homes/users/g/tpl/1ATrading/OurTradingFunctions1.cc; FILE_NAME_1=0;1;0;16;1;1;0;/homes/users/g/tpl/1ATrading/OurTradingFunctions2.cc; FILE_NAME_2=0;1;0;16;1;1;0;/homes/users/g/tpl/1ATrading/OurTradingMain.cc; FILE_NAME_3=0;1;0;16;1;1;0;/homes/users/g/tpl/1ATrading/OurTradingHeader.h;
When you re-start geany it loads in the previous project file it used. You can load new project files or re-load old ones using Open option in the Project menu.
geany sometimes forgets what the Execute button should do. The solution is to load the project file in again.