It's an ambiguous question.
You may place a structure declaration, but not a structure definition.
For example:
Code:
// header example.h:
struct S { ... }; // or
typedef struct { ... } S;
// cpp files:
#include "example.h"
S s; // Global structure variable in 1 file only
// in others:
extern S s;
You may add in the header (after S declaration):
Code:
extern S s;
then write in one of (and the only) files s var definition:
Code:
S s;
If you have in the header
Code:
struct S { ... } s;
- you have not-unique s definitions in cpp files with #include "example.h".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.