k_event_init cannot get to work

So, I follow the zephyr docs (https://docs.zephyrproject.org/latest/kernel/services/synchronization/events.html)

and define an event as:

struct k_event my_event;
k_event_init(&my_event);

However I get the error:

error: expected declaration specifiers or '...' before '&' token
   41 | k_event_init(&my_event);

It works fine with 

K_EVENT_DEFINE(my_event);

So what is going on?

Related