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/12/09 17:56] abajricgetting_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:test-app-create-project.png?600 |}} 
-     - 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. Add the following extra arguments: ''-DADDITIONAL_INCLUDE_DIRS=/home/user/projects/eeros-framework/includes -DADDITIONAL_LINK_DIRS=/home/user/projects/eeros-framework/build/src'' \\ Where user corresponds to your user name. Then click OK. {{ :getting_started:tutorials:test-app-builddir.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 ==== 
- 
-  - 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> 
-  - Open CMAkeLists.txt file, delete the text written on it and copy the following: <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> (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/ 
-  - Build the project by clicking on the "Build" button up, on the left.  
- 
-==== Run the Hello World Program ==== 
- 
-  - Open a terminal 
-  - Navigate to 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 |}}