QObject: cannot open include file 'QtCore/qobjectdefs.h'

2.2k views Asked by At

I have a WPF project for which I would like to use some functions taken from Qt. I have added the path to QtCore to the Additional Include Directories and the path to the lib directory of Qt to the Additional Library Directories. In a class I include QObject.h, and when I build I get an error at row 46 of QObject

fatal error C1083: Cannot open include file 'QtCore/qobjectdefs.h': No such file or directory (compiling source file MyClass.cpp)

In QObject.cpp I can see that at row 46 it tries to include QtCore/qobjectdefs.h, but they are in the same directory, so I'm not surprised that if I delete "QtCore/" in the include the project doesn't show that error (but fails to include the next .h because of the same problem). I tried to create a sample Qt project in Visual Studio and to inclue QObject.h in a class, and it builds without any issue. Is there any way to make the includes work also outside a Qt project without manually deleting "QtCore/" in every include of QObject and the other classes that I will need?

0

There are 0 answers