Lukas Bystricky
Lukas Bystricky

Reputation: 1272

compilation error involving struct

I really dislike asking about compilation errors here, but this one has been really bugging me.

I have the following code:

struct rtModel_capacitor {
  ....
};
extern rtModel_capacitor *const capacitor_rtM;

This gives the error (for the last line):

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

Why won't this compile?

Upvotes: 0

Views: 28

Answers (1)

R Sahu
R Sahu

Reputation: 206557

Different ways to resolve the problem:

struct rtModel_capacitor {
  ....
};
extern struct rtModel_capacitor *const capacitor_rtM;

or

struct rtModel_capacitor {
  ....
};
typedef struct rtModel_capacitor rtModel_capacitor;
extern rtModel_capacitor *const capacitor_rtM;

or

typedef struct {
  ....
}rtModel_capacitor;
extern rtModel_capacitor *const capacitor_rtM;

Upvotes: 2

Related Questions