How to compile the C++ homeworks under Linux
by Dominique Unruh
The following instructions explain how to compile the homework templates on Linux (tested on Mint 17.2 and Ubuntu 14.04.3).
Allegro-based homeworks
- Run
sudo apt-get install liballegro5-dev
- Run
sudo apt-get install codeblocks
- Open the homework in CodeBlocks (e.g.,
codeblocks HelloAllegro.cbp
) - Open the build settings (Project → Build options...)
- Find the Linker settings where "liballegro-5.0.10-monolith-md.a" is added.
- Either by selecting "Linker Settings", or by first selecting "Release" on the left and then "Linker Settings", depending on the homework file
- Remove the library "liballegro-5.0.10-monolith-md.a".
- Add the following libraries: (without the suffix ".a"):
- liballegro
- liballegro_primitives
- liballegro_font
- liballegro_main
- liballegro_memfile
- liballegro_color
- Clean the project (Build → Clean)
- Build the project (Build → Build)
- Run the project (Build → Run). A window with black background appears.
- On one of my laptops, this did not work. In that case, start the program from the command line, e.g. bin/HelloAllegro (in the HelloAllegro project folder)
GLFW-based homeworks
- Run
sudo apt-get install libglfw3
- If your distribution does not have libglfw3 (e.g., Mint 17.2 and Ubuntu 14.04 have only libglfw2):
- Add a new reposity:
sudo apt-add-repository ppa:keithw/glfw3
(I give no security guarantees for untrusted repositories!) sudo apt-get update
sudo apt-get install libglfw3
- Run
sudo apt-get install codeblocks
- Open the homework in CodeBlocks (e.g.,
codeblocks HelloGLFW.cbp
) - Open the build settings (Project → Build options...)
- Find the Linker settings where "glfw3" and "opengl32" and "gdi32" are added.
- Either by selecting "Linker Settings", or by first selecting "Release" on the left and then "Linker Settings", depending on the homework file
- Remove the libraries "glfw3", "opengl32" and "gdi32" (i.e., all of them)
- Add the following library ": (without the suffix ".a"):
GL
glfw
(notglfw3
, at least not if you have used theppa:keithw/glfw3
repository)
- Clean the project (Build → Clean)
- Build the project (Build → Build)
- Run the project (Build → Run). A window with black background appears.
- On one of my laptops, this did not work. In that case, start the program from the command line, e.g. bin/HelloAllegro (in the HelloAllegro project folder)