This basic tutorial shows you how to compile and run a very basic Elektra application. For this tutorial we assume that you installed \hyperlink{doc_INSTALL_md}{Elektra} and \href{http://cmake.org}{\tt C\+Make} on your machine. We also assume that you work a Unix based OS like Linux or mac\+OS.


\begin{DoxyEnumerate}
\item Create a folder called {\ttfamily Hello} somewhere on your disk
\item Copy the file {\ttfamily examples/hello\+Elektra.\+c} to the folder {\ttfamily Hello} you just created
\item Save a file with the following content
\end{DoxyEnumerate}


\begin{DoxyCode}
cmake\_minimum\_required(VERSION 3.0)

find\_package(Elektra REQUIRED)

if (ELEKTRA\_FOUND)
    message (STATUS "Elektra $\{ELEKTRA\_VERSION\} found")
    include\_directories ($\{ELEKTRA\_INCLUDE\_DIR\})

    add\_executable (hello helloElektra.c)
    target\_link\_libraries (hello $\{ELEKTRA\_LIBRARIES\})
else (ELEKTRA\_FOUND)
    message (FATAL\_ERROR "Elektra not found")
endif (ELEKTRA\_FOUND)
\end{DoxyCode}


as {\ttfamily C\+Make\+Lists.\+txt} in the folder {\ttfamily Hello}.


\begin{DoxyEnumerate}
\item Open a shell and change into the directory {\ttfamily Hello}
\item Create a build directory inside {\ttfamily Hello}, change into the build directory, and run Cmake\+:
\end{DoxyEnumerate}


\begin{DoxyCode}
mkdir build
cd build
cmake ..
\end{DoxyCode}


. If everything worked until now, then C\+Make should print messages that look something like this\+:


\begin{DoxyCode}
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: usr/bin/cc
-- Check for working C compiler: usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: usr/bin/c++
-- Check for working CXX compiler: usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Elektra 0.8.26 found
-- Configuring done
-- Generating done
-- Build files have been written to: Hello/build
\end{DoxyCode}



\begin{DoxyEnumerate}
\item Now it’s time to build your application. For that step run {\ttfamily make} inside the folder {\ttfamily Hello/build}\+:
\end{DoxyEnumerate}


\begin{DoxyCode}
make
\end{DoxyCode}


. If the last step completed successfully, then the build directory now contains the application {\ttfamily hello}.


\begin{DoxyEnumerate}
\item You can now run your Elektra application by calling {\ttfamily ./hello} inside the build directory. The output of the application should look something like this\+:
\end{DoxyEnumerate}


\begin{DoxyCode}
Open key database
Retrieve key set
Number of key-value pairs: 0
Add key user/test/hello
Number of key-value pairs: 1

hello, elektra

Delete key-value pairs inside memory
Close key database
\end{DoxyCode}



\begin{DoxyEnumerate}
\item You can now change the content of {\ttfamily hello\+Elektra.\+c}. If you want to compile and execute the updated code, then repeat steps 6 and 7. 
\end{DoxyEnumerate}