====== Writing EEROS Applications for the Host ====== Back to [[getting_started:compile_eeros_host|]]. You will use C++ to develop your EEROS applications. For this you need at least some knowledge of the basic language features. A good starting point might be [[https://www.cplusplus.com/doc/tutorial/]]. Minimal help can also be found under [[tools:cplusplus|]]. What do you want to do next? * [[getting_started:write_app:use_on_host#Say Hello with EEROS|]] * [[getting_started:write_app:use_on_host#Use Existing Project|]] ===== Say Hello with EEROS ===== - Create a project directory within your EEROS project directory and change into it with $ mkdir hello $ cd hello - Create a text file "main.cpp" and copy the following code into it #include #include #include int main() { using namespace eeros::logger; Logger::setDefaultStreamLogger(std::cout); Logger log = Logger::getLogger(); log.info() << "Hello, EEROS"; return 0; } - Create a text file "CMakeLists.txt" and copy the following text into it: cmake_minimum_required(VERSION 3.10) project(helloworld) find_package(EEROS REQUIRED) add_executable(helloworld main.cpp) target_link_libraries(helloworld PRIVATE eeros) - Create a build directory for your new project and change into it with $ mkdir build-x86 $ cd build-x86 - Build the project with $ cmake -DCMAKE_INSTALL_PREFIX=../../install-x86 ../../hello $ make - Make changes to "main.cpp", save them and rebuild with $ make In order to be able to write your own EEROS programs, you could use any text editor. However, we recommend to use an integrated development environment, see [[getting_started:kdevelop|]]. Continue with [[getting_started:deploy:deploy_host|]]. ===== Use Existing Project ===== As an example we use the [[getting_started:tutorials:oneaxis|]] demo program. - Fetch the code of the application from within your EEROS project directory with $ git clone https://github.com/eeros-project/simple-motor-control.git $ cd simple-motor-control - Create a build directory for your new project and change into it with $ mkdir build-x86 $ cd build-x86 - Build the project with $ cmake -DCMAKE_INSTALL_PREFIX=../../install-x86 -DREQUIRED_EEROS_VERSION=1.3 ../../simple-motor-control $ make Continue with [[getting_started:deploy:deploy_host|]].