Avb Avb
Avb Avb

Reputation: 553

c++ static struct does not name a type

In ClassA.h I define a struct pointer like:

 struct timestr
 {
  uint64_t timestart;
  uint64_t timeend;
 };

 static timestr *extime;

And in the ClassA.cpp, I initialize like:

timestr *ClassA::extime = NULL;

however I got error: timestr does not name a type. What is wrong here?

Upvotes: 0

Views: 911

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409404

Probably because the timestr structure is inside the containing class, in which case you need to use the scoping for that too:

ClassA::timestr *ClassA::extime = NULL;

Upvotes: 3

Related Questions