User Tools

Site Tools


getting_started:tutorials:say_hello

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
getting_started:tutorials:say_hello [2017/06/22 09:12] – created grafgetting_started:tutorials:say_hello [2017/11/20 13:44] – [Test Program] graf
Line 1: Line 1:
 ====== Say Hello with EEROS ====== ====== Say Hello with EEROS ======
  
-==== Preparation ==== +===== Preparation ===== 
-  - Setup an development environment as desribed [[getting_started:install_and_setup_development_environment:|here]]+We suggest to use [[https://www.kdevelop.org/]]. Get the program with 
 +<code> 
 +$ apt-get install kdevelop 
 +</code> 
 + 
 +===== Create a New Project =====
   - Start KDevelop   - Start KDevelop
   - Create a new C++ project:   - Create a new C++ project:
Line 8: Line 13:
      - Choose Standard/Terminal as project type and type a project name (e.g. test-project). {{ :getting_started:tutorials:test-app-create-project.png?600 |}}      - 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      - 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 [[getting_started:compile_eeros|Compiler EEROS]]). If EEROS is installed globally leave this field blank (not recommended). {{ :getting_started:tutorials:test-app-builddir.png?600 |}} +     - 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 [[getting_started:compile_eeros|]]). If EEROS is installed globally leave this field blank (not recommended). {{ :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. +===== Test Program =====
-==== Say Hello World with EEROS ====+
  
   - Copy the following code into "main.cpp" <code cpp>   - Copy the following code into "main.cpp" <code cpp>
Line 19: Line 23:
    
 int main() { int main() {
- using namespace eeros::logger;+  using namespace eeros::logger;
    
- StreamLogWriter w(std::cout); +  StreamLogWriter w(std::cout); 
- Logger log;+  Logger log
 +  log.set(w);
    
- log.info() << "Hello, EEROS";+  log.info() << "Hello, EEROS";
  
- return 0;+  return 0;
 } }
 </code> </code>
-  - Open CMakeLists.txt file, delete the text written on it and copy the following: <code cpp>+  - Open CMakeLists.txt file, delete the text written on it and copy/paste the following into it: <code cpp>
 cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
 + 
 project(test-project) project(test-project)
 + 
 find_package(EEROS REQUIRED) find_package(EEROS REQUIRED)
-include_directories(${EEROS_INCLUDE_DIR}) +include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR}) 
-link_directories(${EEROS_LIB_DIR}) +link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR}) 
 + 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 + 
 add_executable(test-project main.cpp) add_executable(test-project main.cpp)
-target_link_libraries(test-project eeros)+target_link_libraries(test-project eeros ucl ${CMAKE_DL_LIBS})
 </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/abajric/work/test-project)  </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/abajric/work/test-project) 
   - Build the project by clicking on the "Build" button up, on the left.    - Build the project by clicking on the "Build" button up, on the left. 
  
-==== Run the Hello World Program ====+===== Run the Hello World Program =====
  
   - Open a terminal   - Open a terminal
Line 52: Line 57:
  
 {{ :getting_started:tutorials:hello.png?800 |}} {{ :getting_started:tutorials:hello.png?800 |}}
 +
 +===== Use KDevelop with Existing Build Configuration =====
 +If you have previously built your application manually or with the aid of the EEROS build scripts ([[https://github.com/eeros-project/eeros-build-scripts]]), you can import the configuration into KDevelop as follows:
 +  - Import the project by choosing the ''CMakeLists.txt'' of your project.
 +  - Right click on the project and open the project configuration panel.
 +  - Choose the build directory of the previously built application as your build directory
 +  - Leave the entries for install directory, build type, and extra arguments empty. These settings will be fetched from the existing CMake configuration in your build directory.
 +  - Click ''Ok''
 +  - Build