In fact I’m not really here for a question but to share an issue which drived me crazy during hours.
The classical solution for the error ‘expected unqualified-id […]’ in most of the cases is a missing semicolon at the end of your class declaration. That is not the case here.
Now let me explain what happened. I needed a class a some objects developped by a co-worker and those sources where already used by other part of the soft. So I know it’s working and usable. So I modified my makefile and my includes, recompile and boom, I have that:
foobar.hh:81: error: expected unqualified-id before “protected”
I was including pretty much the same things than my co-worker with similar makefile and environnement, so I couldn’t understand the issue. But finally, we found the big difference:
I’m using QT (since I’m developping a GUI) and the methods pointed by the compiler where the errors occured were all named ‘signals’.
I don’t have the full explanation, but we only changed the methods names to something else, and it’s working. For QT users, you know that signals is a specific QT word, used for the signal/slot mechanism, but I still lost a lot of time on that. If somebody can explain precisely the issue I’m interested, but I wanted to share this quick workaround with you (and because stackoverflow helped me by the past a loooot of time).
Regards,
Ikwy
signalsis a kind keyword in Qt. This name can not be used as identifier in Qt. You cannot declare functions or variables with this name.qmake) withCONFIG += no_keywordsoption enabled)