Problem including slist.h


yshragai.firmware@...
 

D'oh! It's always simple once you see it.
Thanks 🙂


honestech
 

Hi,

There isn't a structure named sys_snode_t exactly. Please look at this. https://docs.zephyrproject.org/apidoc/latest/slist_8h.html

typedef struct _snode sys_snode_t

So it should be like this:
struct mystruct
{
    struct device mydevice;
    struct k_sem semaphore;
    sys_snode_t snode;
};

Cheers


yshragai.firmware@...
 

Hi,
I have this struct defined in a .h file:
struct mystruct
{
    struct device mydevice;
    struct k_sem semaphore;
    struct sys_snode_t snode;
};

I have included slist.h thus:
#include <sys/slist.h>

I know that the build is properly including slist.h, because when I put a nonsense line in slist.h, the build breaks on it.

And yet, (without nonesense in slist.h) the build fails on:
error: field 'snode' has incomplete type
     struct sys_snode_t snode;
                        ^~~~~
What gives?

This might be related, or might not:
In VS Code, I can do "Go to definition" on the struct device or struct k_sem, and it correctly goes to their definitions in device.h and kernel.h respectively.
However, if I do "Go to definition" on the struct sys_snode_t, it doesn't go anywhere.
(But if I ctrl-click on slist.h in the #include, it does open the file in the correct location.)

Thanks!