User Tools

Site Tools


getting_started:say_hello

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
Next revisionBoth sides next revision
getting_started:say_hello [2019/04/25 11:44] – [Test Program] grafgetting_started:say_hello [2020/01/23 15:22] – [Use KDevelop with Existing Build Configuration] graf
Line 1: Line 1:
 ====== Say Hello with EEROS ====== ====== Say Hello with EEROS ======
-In order to be able to write your own EEROS programs or alter existing example applications, it is necessary to setup a development environment. +In order to be able to write your own EEROS programs or alter existing example applications, you could use any text editor and use the ''make.sh'' script on the command line. However, we recommend to use an integrated development environment. 
  
 ===== Preparation ===== ===== Preparation =====
Line 12: Line 12:
   - Create a new C++ project:   - Create a new C++ project:
      - Project -> New from Template...      - 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 |}}+     - Choose Standard/Terminal as project type and type a project name (e.g. test-project). {{ :getting_started: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|]]). 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:test-app-builddir.png?600 |}} If your development architecture is different from your target architecture, you have to choose an toolchain file as described in [[getting_started:host_and_target|]]. You can enter this file in the field "Extra Arguments" with //DCMAKE_TOOLCHAIN_FILE=path/to/toolchain-file.cmake//.
 ===== Test Program ===== ===== Test Program =====
  
Line 35: Line 34:
 } }
 </code> </code>
-  - Open CMakeLists.txt file, delete the text written on it and copy/paste the following into it: <code cpp>+  - Open CMakeLists.txt file, delete the text written in it and copy/paste the following into it: <code cpp>
 cmake_minimum_required(VERSION 3.5.1) cmake_minimum_required(VERSION 3.5.1)
-  +project(helloworld) 
-project(test-project+ 
- +set(CMAKE_CXX_STANDARD 14
 find_package(EEROS REQUIRED) find_package(EEROS REQUIRED)
 include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR}) include_directories(${EEROS_INCLUDE_DIR};${EEROS_LIBUCL_INCLUDE_DIR})
 link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR}) link_directories(${EEROS_LIB_DIR};${EEROS_LIBUCL_LINK_DIR})
-  + 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11"+add_executable(helloworld main.cpp) 
-  +target_link_libraries(helloworld eeros ucl ${CMAKE_DL_LIBS}) 
-add_executable(test-project main.cpp) +</code> (Note 1: "helloworld" 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 foldere.g. /home/you/work/helloworld
-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 foldere.g. /home/you/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 =====
 +If you run your test program on the host machine continue below. 
 +If you want to do a crossdevelopment, you have to deploy your libraries and test program first. Go to [[getting_started:deploy|]] first before you continue below. 
   - Open a terminal   - Open a terminal
-  - Navigate to the build folder of your project (e.g. cd /home/abajric/work/build-test-project-x86-64) +  - Navigate to the build folder of your project (e.g. cd /home/you/work/build-x86-64) 
-  - Run the program with the command: ./testproject+  - Run the program with the command: ./test-project
  
-{{ :getting_started:tutorials:hello.png?800 |}}+{{ :getting_started:hello.png?600 |}}
  
 ===== Use KDevelop with Existing Build Configuration ===== ===== 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:+If you have previously built your application manually or with the aid of the [[getting_started:install_and_setup_development_environment#Getting_the_Sources_with_a_Script|EEROS build scripts]], you can import the configuration into KDevelop as follows:
   - Import the project by choosing the ''CMakeLists.txt'' of your project.   - Import the project by choosing the ''CMakeLists.txt'' of your project.
   - Right click on the project and open the project configuration panel.   - Right click on the project and open the project configuration panel.
Line 67: Line 66:
   - Click ''Ok''   - Click ''Ok''
   - Build   - Build
 +
 +If you are using ROS in your applications make sure that you fullfill the necessary steps described in [[getting_started:ros#Preparations_and_Building|ROS: Preparations and Building]].