Hello World 4 - building C++ solutions for my computer

Audience

Level Advanced user Time 5 min
OS Linux - Windows - Mac Preparation 1 hour

Preparation time is given for the case you have to install tools prior the tutorial.

Before starting

  • Make sure you have a robot ready to use, or read the Out of the box section.

  • Make sure C++ and C++ SDK are installed on your computer.
    If it is not the case, see C++ SDK Installation.

Let’s do it

Step Action

Open a Command Prompt and go to the examples folder included in the C++ SDK documentation.

$ cd /path/to/cpp/sdk/doc/examples

Where /path/to/cpp/sdk is the path of the C++ SDK.

For example, Windows users will do:

../_images/helloworld_cpp_computer.png

Type this command in order to create a worktree:

$ qibuild init

Type this command in order to create a default toolchain using the feed from the C++ SDK:

$ qitoolchain create mytoolchain /path/to/cpp/sdk/toolchain.xml --default

Where /path/to/cpp/sdk is the path of the C++ SDK.

Type these commands in order to configure and build the sayhelloworld project:

$ qibuild configure sayhelloworld
$ qibuild make sayhelloworld

Go to the folder containing the result of the build:

$ cd /path/to/cpp/sdk/doc/examples/core/sayhelloworld/build-mytoolchain/sdk/bin

Type this command in order to test the result:

$ sayhelloworld <IP of your robot>

Where <IP of your robot> is the IP address of your robot.

If you don’t know the IP address of your robot, press its Chest button, he will say it.

Result

Your robot says “Hello, world”.

What you have learned

qiBuild allows you to prepare and cross-compile a full C++ solution with 2 lines: configure and make.

To go further

Next step

Running C++ solution on your computer is nice, but if you want to create solution running on your robot,
you’ll have to cross-compile for OpenNAO: Hello World 5 - building C++ solutions for my robot.