26 February 2015 to 12 March 2015
Europe/Rome timezone

Examples

Source code examples

The examples shown during each seminar are available on github at the following link:

https://github.com/mfrailis/cpp_examples

They can be downloaded either as a zip file:

https://github.com/mfrailis/cpp_examples/archive/master.zip

or using the Git version control system. For instance, when using the virtual machine provided in the Additional material section of this course, you can open a terminal emulator and type the following command:

$ git clone https://github.com/mfrailis/cpp_examples.git

The above command will create a directory called "cpp_examples", containing the source code.

To compile and run the code you can open the file cpp_examples.cbp with the Code::Blocks IDE (see below) or, using the terminal emulator, you can run the following commands:

$ cd cpp_examples  # change to the root directory of the source code

$ make   # builds all the examples

The last command will create the executables in the cpp_examples/bin directory.

When additional examples are available, the code can be also updated from the github repository launching the following command in the root folder of the examples:

$ git pull

 

Using Code::Blocks to build and run the examples

The source code examples include a top level project file for Code::Blocks. The file is located in the root folder of the source code and it is named cpp_examples.cbp.

To build and run the code, open the file cpp_examples.cbp with Code::Blocks. In the application toolbar (see figure below), click on the build targets drop-down list and select one of the examples (step 1 in figure). Then, click on the Build button (step 2) and, after successful completion of this step, click the Run button (step 3).

Code::Blocks building a target