Hello KodoΒΆ

This example shows how to use our build system to create a simple C++ application which depends on kodo-rlnc. The example consists of 3 files: main.cpp, wscript and waf.

main.cpp contains a very limited amount of code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// Copyright Steinwurf ApS 2015.
// Distributed under the "STEINWURF RESEARCH LICENSE 1.0".
// See accompanying file LICENSE.rst or
// http://www.steinwurf.com/licensing

//! [0]
#include <kodo_rlnc/full_vector_codes.hpp>
//! [1]
#include <iostream>

int main()
{
    std::cout << "Hello Kodo!" << std::endl;
    return 0;
}

It’s basically a main function which prints Hello Kodo! and exits. In this example, we include a particular RLNC codec defined in the following header file:

1
#include <kodo_rlnc/full_vector_codes.hpp>

The include is not used however. Its only purpose is to detect whether or not the include paths for the kodo-rlnc library are configured correctly.

The remaining two files are needed to build the executable. The waf file is a complete standalone build system, whereas the wscript is the recipe used by waf to build our example. The wscript contains information regarding dependencies and build targets. The simplest way to get started is to copy the files to a folder of your own choosing, and then run the following commands in a terminal (while using the selected folder as your working directory).

python waf configure
python waf build

The build system will download all dependencies, compile some static libraries and finally the example. You can find the compiled executable in the waf build folder, which depends on your operating system:

  1. Linux: ./build/linux
  2. Mac OSX: ./build/darwin
  3. Windows: ./build/win32

You can directly run the executable by executing the appropriate command:

./build/linux/hello_kodo
./build/darwin/hello_kodo
build\win32\hello_kodo.exe

You can use this as a starting point for the coming examples, or even your own application.

For more information regarding how to use the waf build systems, go here.