User Tools

Site Tools


getting_started:tutorials:helloworld

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
getting_started:tutorials:helloworld [2015/09/23 13:43] – [Preparation] grafgetting_started:tutorials:helloworld [2018/11/13 10:25] (current) – removed graf
Line 1: Line 1:
-====== Getting started with the EEROS robotics framework ====== 
  
-==== Preparation ==== 
-  - Setup an development environment as desribed [[getting_started:install_and_setup_development_environment:|here]] 
-  - Start KDevelop 
-  - Create a new C++ project: 
-     - Project -> New from Template... 
-     - Choose Standard/Terminal as project type and type a project name (e.g. test-project). {{ :getting_started:tutorials:newproject.png?400 |}} 
-     - Create the project by clicking Finish 
-     - Follow the instructions to create the build directory with the given default settings. Check that the build folder is within the project folder and then click OK. {{ :getting_started:tutorials:2builddir.png?600 |}} 
-     - Check the build sequence on the left bottom of Kdevelop. "eeros-framework" must be before the new project (in this example "test-project"). {{ :getting_started:tutorials:2buildsequence.png?200 |}} 
-     - Build the project with the build button. 
-==== Say Hello World with EEROS ==== 
- 
-1. Copy the following code into "main.cpp" 
- 
-<code cpp> 
-#include <iostream> 
-#include <eeros/logger/Logger.hpp> 
-#include <eeros/logger/StreamLogWriter.hpp> 
- 
-int main() { 
- using namespace eeros::logger; 
-  
- StreamLogWriter w(std::cout); 
- Logger<LogWriter>::setDefaultWriter(&w); 
- Logger<LogWriter> log; 
-  
- log.info() << "Hello, EEROS"; 
-  
- return 0; 
-} 
-</code> 
- 
-2. Open CMAkeLists.txt file, delete the text written on it and copy the following:  
-(Note 1: "test-project" is the name of the dummy-project created for the example. Put your project name where "test-project" is. Note 2: This file is in the project folder. e.g. /home/user/projects/test-project/) 
- 
-<code cpp> 
-cmake_minimum_required(VERSION 2.8) 
- 
-project(test-project) 
- 
-include_directories(${ADDITIONAL_INCLUDE_DIRS}) 
-link_directories(${ADDITIONAL_LINK_DIRS}) 
- 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 
- 
-add_executable(test-project main.cpp) 
- 
-target_link_libraries(test-project eeros) 
-</code> 
- 
-3. Open CMakeCache.txt file and add the following:  
-(Note 1: This file is in the build folder, in the project folder. e.g. /home/user/projects/test-project/build/. Note 2: Substitute "user" with your user account name) 
- 
-<code cpp> 
-ADDITIONAL_INCLUDE_DIRS:UNINITIALIZED=/home/user/eeros-framework/includes 
-ADDITIONAL_LINK_DIRS:UNINITIALIZED=/home/user/eeros-framework/build/src 
-</code> 
- 
-See example: 
- 
-{{ :getting_started:tutorials:ccache2.png?600 |}} 
- 
-4. Build the project by clicking on the "Build" button up, on the left.  
- 
-==== Run the Hello World Program ==== 
- 
-  - Open a terminal 
-  - Navigate until the build folder of your project (e.g. cd /projects/test-project/build/) 
-  - Run the program with the command: ./testproject 
- 
-{{ :getting_started:tutorials:hello.png?800 |}} 
getting_started/tutorials/helloworld.1443008589.txt.gz · Last modified: 2015/09/23 13:43 (external edit)