I used to have a class called Constants. In it was this typedef:
typedef enum visible_thing {
BACKGROUND,
BACKGROUND_COLOR,
MAIN_WINDOW
} VISIBLE_THING;
And my, was life rosy! I was importing ‘Constants.h` wherever I needed to access this type, and it all worked.
Then I decided to nuke the Constants class. I took the typedef and I put it in another class, for clarity let’s call it OtherClass. I went through and changed all the imports of Constants.h to imports of OtherClass.h That’s all I did, I didn’t touch any other code. And now the whole thing’s broke!
Methods that worked perfectly with Constants now give me this error: Parse Issue - Expected a type. What the heck? I sure hope someone has some leads on this!
Update: frustratingly, this is one of those problems that just seemed to go away on its own without explanation. I answered my own question, below, with a workaround I’d found that entailed #import-ing the same header multiple times in one file. But today I removed the extra #import, and everything still worked. Arg. Computers!
The class that was generating the errors had two other class definitions inside it, helper classes that were only used internally. Apparently that was the root of the problem.
What I didn’t know was that if you do that, if there is more than one class in a file, you may need to import the same header multiple times.
Here’s what I did to fix it. I changed this:
To this:
Which seems clunky and like I may be doing something else wrong, but at least it fixed the issue at hand. Any follow-up comments will be appreciated.