From a0b4cc7d526661978d903f0fd18fbdd8e5fb847d Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Thu, 26 Oct 2017 03:16:19 -0700 Subject: [PATCH] Wiki page hello-world.md changed with summary [created] by Xavi Artigas --- pages/develop/tutorial/c/hello-world.md.txt | 62 +++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 pages/develop/tutorial/c/hello-world.md.txt diff --git a/pages/develop/tutorial/c/hello-world.md.txt b/pages/develop/tutorial/c/hello-world.md.txt new file mode 100644 index 000000000..0d7db4902 --- /dev/null +++ b/pages/develop/tutorial/c/hello-world.md.txt @@ -0,0 +1,62 @@ +--- +~~Title: Tutorial 1: Hello World~~ +--- + +# Tutorial 1: Hello World # + +This tutorial will guide you through the necessary steps to build your first "Hello World" example. Make sure you have read the [Setting up the development environment](devenv-setup.md) guide first! + +Don't be afraid, there is very little code in this first tutorial. The main goal is to learn how to build and execute an application using the EFL library. Should we start? + +## The Program ## + +Copy the following program into a text file named ``hello-world.c``: + +```c +#include +#include +#include + +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Loop_Arguments *args = ev->info; + + if (eina_array_count(args->argv) == 0) + { + printf("Hello World!\n"); + } + else + { + printf("Hello %s!\n", (char *) eina_array_data_get(args->argv, 0)); + } + + efl_exit(0); +} + +EFL_MAIN() +``` + +Now build the application as described in the [Setting up the development environment](devenv-setup.md#Building) guide. As a quick reminder, this is the required command if you are using the `gcc` compiler: + +```bash +gcc -o hello-world hello-world.c `pkg-config --cflags --libs eina efl elementary` -DEFL_EO_API_SUPPORT=1 -DEFL_BETA_API_SUPPORT=1 +``` + +If you got no warnings in the process, your program should be ready. Go ahead and test it! Just type: + +```bash +./hello-world +``` + +And you should se the words `Hello World!` printed on the screen. Moreover, if you provide your name to the program in the command line: + +```bash +./hello-world Mike +``` + +You should be greeted personally: `Hello Mike!` + +## Walkthrough ## + +## Conclusion ## \ No newline at end of file