I've going through some code recently to learn more about programming in C++ and I'm facing something somehow a bit odd.
I got a class declaration :
class myClass : public QObject, public virtual myObject::myOtherObject::myInterface {
Q_OBJECT
public: [...]
}
And I got the following error while compiling :
error: expected class-name before '{' token
error: myInterface is not a member of 'myObject::myOtherObject'
Is this a syntax error somewhere ? I can't figure out what is the problem ...
Do you happen to know what could be the solution ?
Many thanks :)
EDIT : The interface was irrelevant and the solution elsewhere. Nevertheless the answers helped .
Is this a syntax error somewhere?
No, your code is syntactically correct. The following compiles fine, without error:
#include <QObject>
namespace myObject {
namespace myOtherObject {
class myInterface {
};
}
}
class myClass : public QObject, public virtual myObject::myOtherObject::myInterface {
Q_OBJECT
public:
};
So, you need to check where your myInterface
class is defined and make sure that it is properly included.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.