Hey everyone,

I'm attempting to write a header file, example.h that will contain function declarations that will be defined in example.c. For some reason Its giving me an error when i do this

extern void mainMenu(node*);

Now node is a struct defined in another header file, should I include that as an extern variable as well?

Something like extern struct node; ??

Thanks for the help in advance.

Recommended Answers

All 2 Replies

>>should I include that as an extern variable as well?
No. All you have to do is include the head file that defines the struct at the top of example.h. And don't forget to use code gards in both head files.

Thanks a lot. That solved it right up. Thought I could get away without including it and just declaring it as an extern but I guess theres no way around it. Thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.