Wiki page hello-world.md changed with summary [created] by Xavi Artigas

This commit is contained in:
Xavi Artigas 2017-10-26 03:16:19 -07:00 committed by apache
parent 7ee68615ff
commit a0b4cc7d52
1 changed files with 62 additions and 0 deletions

View File

@ -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 <Eina.h>
#include <Efl.h>
#include <Elementary.h>
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 ##