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
Next revisionBoth sides next revision
getting_started:tutorials:helloworld [2015/12/09 17:59] abajricgetting_started:tutorials:helloworld [2015/12/09 18:02] abajric
Line 17: Line 17:
 #include <eeros/logger/Logger.hpp> #include <eeros/logger/Logger.hpp>
 #include <eeros/logger/StreamLogWriter.hpp> #include <eeros/logger/StreamLogWriter.hpp>
 + 
 int main() { int main() {
  using namespace eeros::logger;  using namespace eeros::logger;
- + 
  StreamLogWriter w(std::cout);  StreamLogWriter w(std::cout);
  Logger<LogWriter>::setDefaultWriter(&w);  Logger<LogWriter>::setDefaultWriter(&w);
  Logger<LogWriter> log;  Logger<LogWriter> log;
- + 
  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 the following: <code cpp>
 cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
  
 project(test-project) project(test-project)
  
-include_directories(${ADDITIONAL_INCLUDE_DIRS}) +find_package(EEROS REQUIRED) 
-link_directories(${ADDITIONAL_LINK_DIRS})+include_directories(${EEROS_INCLUDE_DIR}) 
 +link_directories(${EEROS_LIB_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)
-</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/+</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. 
  
Line 49: Line 49:
  
   - Open a terminal   - Open a terminal
-  - Navigate to the build folder of your project (e.g. cd /projects/test-project/build/)+  - Navigate to the build folder of your project (e.g. cd /home/abajric/work/build-test-project-x86-64)
   - Run the program with the command: ./testproject   - Run the program with the command: ./testproject
  
 {{ :getting_started:tutorials:hello.png?800 |}} {{ :getting_started:tutorials:hello.png?800 |}}