getting_started:tutorials:say_hello
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
getting_started:tutorials:say_hello [2017/06/22 09:12] – created graf | getting_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 | + | We suggest to use [[https:// |
+ | < | ||
+ | $ apt-get install kdevelop | ||
+ | </ | ||
+ | |||
+ | ===== Create a New Project ===== | ||
- Start KDevelop | - Start KDevelop | ||
- Create a new C++ project: | - Create a new C++ project: | ||
Line 8: | Line 13: | ||
- Choose Standard/ | - Choose Standard/ | ||
- 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 " | + | - 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 " |
- | - Check the build sequence on the left bottom of Kdevelop. " | + | |
- | - Build the project with the build button. | + | ===== Test Program ===== |
- | ==== Say Hello World with EEROS ==== | + | |
- Copy the following code into " | - Copy the following code into " | ||
Line 19: | Line 23: | ||
int main() { | int main() { | ||
- | using namespace eeros:: | + | |
- | StreamLogWriter w(std:: | + | |
- | Logger log; | + | Logger log; |
+ | log.set(w); | ||
- | log.info() << " | + | |
- | return 0; | + | |
} | } | ||
</ | </ | ||
- | - 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/ |
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}; |
- | link_directories(${EEROS_LIB_DIR}) | + | link_directories(${EEROS_LIB_DIR}; |
+ | |||
set(CMAKE_CXX_FLAGS " | set(CMAKE_CXX_FLAGS " | ||
+ | |||
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}) |
</ | </ | ||
- Build the project by clicking on the " | - Build the project by clicking on the " | ||
- | ==== Run the Hello World Program ==== | + | ===== Run the Hello World Program |
- Open a terminal | - Open a terminal | ||
Line 52: | Line 57: | ||
{{ : | {{ : | ||
+ | |||
+ | ===== Use KDevelop with Existing Build Configuration ===== | ||
+ | If you have previously built your application manually or with the aid of the EEROS build scripts ([[https:// | ||
+ | - Import the project by choosing the '' | ||
+ | - 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 '' | ||
+ | - Build |