Institute of Computer Science
  1. Courses
  2. 2023/24 fall
  3. Computer Graphics (MTAT.03.015)
ET
Log in

Computer Graphics 2023/24 fall

  • Main
  • Lectures
  • Practices
  • Projects
  • Exam
  • Results
  • Links

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 (not glfw3, at least not if you have used the ppa: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)
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment