This is a very frustrating error message in Qt Creator: ’XYZ’ does not name a type
. This usually means that there is an error in the class XYZ
that prevents the compiler from generating the type, but there are no additional hints as to what went wrong.
Any suggestions?
I found this problem on qtcreator 3.4.1 and QT 5.4, when I replace such as
#include <QTextEdit>
with
class QTextEdit;
this problem gone.
i just had this problem, and like Arckaroph have said : the problem is that when we include a header file in a source code file, and we use in it the directive #ifndef, we can't include it again in a header file to give a type of it's included class to a variable in source code file
example :
class1.h contains Class1 class2.h contains Class2 class2 have a private variable V with class1 type if we include class1.h in class2.CPP we can't include it in class2.h to give V a class1 type.
so we put in class2.cpp class2.h before class1.h or we delete class1.h from class2.cpp