I have weird problem with Qt 4. I'm trying to make QList of MyClass, but it says MyClass: undeclared identifier. I'm using it in global objects.. here's code and let me know what I'm doing wrong. Regards.
global_objects.h:
#ifndef GLOBAL_OBJECTS_H
#define GLOBAL_OBJECTS_H
#include <QList>
#include "myclass.h"
extern QList<MyClass*> Test; //undeclared identifier, why???
#endif // GLOBAL_OBJECTS_H
global_objects.cpp:
#include "global_objects.h"
QList <MyClass*> Test;
MyClass is empty QObject, haven't added anything yet. What's the problem ?!
You have a mutual inclusion problem: for your purposes, i think it is sufficient to forward-declare MyClass in global_objects.h. You do not need to #include myclass.h there