Randomblue
Randomblue

Reputation: 116283

struct: Storage size unknown, or variable undeclared

I want to call a function low_level_init which has signature

void low_level_init(struct netif *netif)

I have tried

struct netif dummy;
low_level_init(&dummy);

but I get the error

storage size of 'dummy' isn't known

I have also tried (as suggested here)

extern struct netif dummy;
low_level_init(&dummy);

but then I get the error

error: 'dummy' undeclared (first use in this function)

How can I call low_level_init?

Upvotes: 1

Views: 5774

Answers (1)

Paul Praet
Paul Praet

Reputation: 1387

Include the header file where that structure is defined. Otherwise the compiler cannot know how much space to reserve.

Upvotes: 3

Related Questions