Hi there,
here's a really quick question:
say I have some files:
linalg.h
Code:
typedef struct {
...
} evector;
void copyMatrix2D( double **dst, double **src, int nrows, int ncols );
...
electron.h
Code:
#include linalg.h
typedef struct {
evector r;
...
} diffuser;
void moveDmcElectron( evector *epos, gsl_rng *r, const double sigma );
...
test.c
Code:
#include electron.h
extern inline void moveDmcElectron( evector *epos, gsl_rng *r, const double sigma );
#include linalg.h
extern inline void copyMatrix2D( double **dst, double **src, int nrows, int ncols );
...
Basically when I try to compile (I compiled the various bits seperately, then try to link when compiling test.c) - it complains that I have two definitions of 'evector' (a typedef'd struct).
Is there a way to get around this? for eg telling the compiler not to include a header that it's already included (even if it was indirectly?)
There has to be a way around this, because people would do this all the time surely? (ie include two headers, one of which also includes the other one, but for different reasons.
cheers