forked from enlightenment/www-content
Wiki page hello-world.md changed with summary [created] by Xavi Artigas
This commit is contained in:
parent
7ee68615ff
commit
a0b4cc7d52
|
@ -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 ##
|
Loading…
Reference in New Issue