getting_started:tutorials:say_hello
This is an old revision of the document!
Say Hello with EEROS
Preparation
We suggest to use https://www.kdevelop.org/. Get the program with
$ apt-get install kdevelop
- Start KDevelop
- Create a new C++ project:
- Project → New from Template…
- Create the project by clicking Finish
- Create the build configuration. It is recommended to put the target architecture in the name of the build folder. Put the location where EEROS is installed in the “Installation Prefix” field. Important: make sure that this is the location where you have installed EEROS (see Compile). If EEROS is installed globally leave this field blank (not recommended).
- Build the project with the build button.
Say Hello World with EEROS
- Copy the following code into “main.cpp”
#include <iostream> #include <eeros/logger/Logger.hpp> #include <eeros/logger/StreamLogWriter.hpp> int main() { using namespace eeros::logger; StreamLogWriter w(std::cout); Logger log; log.info() << "Hello, EEROS"; return 0; }
- Open CMakeLists.txt file, delete the text written on it and copy the following:
cmake_minimum_required(VERSION 2.8) project(test-project) find_package(EEROS REQUIRED) include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR}) link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") add_executable(test-project main.cpp) target_link_libraries(test-project eeros ucl ${CMAKE_DL_LIBS})
(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/abajric/work/test-project)
- Build the project by clicking on the “Build” button up, on the left.
Run the Hello World Program
getting_started/tutorials/say_hello.1498117006.txt.gz · Last modified: 2017/06/22 09:36 by graf