Procedure for Linux/Ubuntu system
System setup
> You system need to have access to C++ compilation tools, CMake, and the GLFW library.- All tools and libraries could usually be installed from the standard package manager of your distribution. The installation has to be only done once for all.
- Note that you will need root rights to install these on your system (your root password will be asked). If you a using a school computer, these tools and library will already be installed and you won't have to do these steps, you can go to the next step.
# Make sure that your apt deposit is updated [optional] sudo apt-get update # Basic development tools (g++, make, etc) sudo apt-get install build-essential # Install CMake tool sudo apt-get install cmake # Install GLFW library sudo apt-get install libglfw3-dev
Compile and execute the code
Once your system is set up, make a test to compile a test program.- Note these steps will need to be followed for every new program.
- = the directory containing the file CMakeLists.txt - here is it the directory sample_code
# Generate the directory build/ mkdir build # Go to the build/ directory cd build # Run CMake cmake .. # A file Makefile should be generated # Compile make # Make sure the compilation succeed, a file pgm should be created # Go back to the root directory cd .. # Run the executable from the root directory # (possibly adapt to the name of your executable) build/sample_code
- - The build/ directory contains only temporary files that are generated from cmake and during the compilation. This directory can be safely removed and re-generated if needed.
- - If a source file is modified, only make has to be called
- - If a new file is added, CMake must be called again
IDE
You are highly encouraged to use a complete IDE to edit the C++ code: it helps to use the library with auto-completion, to naviguate quickly through the files, as well as proposing debug tools.In Linux/Ubuntu, you can install QtCreator with the following command
sudo apt-get install qtcreator