Reputation: 16724
So I'm trying to create a dll using QT creator. I went to new project -> libary -> C++ libary -> choose
. It generated automatically a header file with global
prefix and a include header that can't be found:
#include <QtCore/qglobal.h>
give the error:
error: QtGlobal: No such file or directory
I find that this header is being included to use Q_DECL_EXPORT
macro so I searched where this is defined: here
. So I did #include <QtGlobal>
header but get same error.
What's the source of error and how can I fix this?
Upvotes: 2
Views: 20757
Reputation: 1
Add a QTDIR to the system environment variable ,restart VS and refer to $(QTDIR) in the VS project configuration
enter image description here enter image description here
Upvotes: -1
Reputation: 1
The QT creator created the project with the following line in the .pro file: I had to remove/commented using # the whole line below
# QT -= core gui
Upvotes: 0
Reputation: 16724
Found the solution!
The QT creator created the project with the following line in the .pro
file:
QT -= core gui
Note the -=
operator, this was preventing the linking of core
library then the not found of #include <QtCore/qglobal.h>
just removed the core
from that line and it compiled fine.
Upvotes: 1
Reputation: 2569
You probably need to add the following to your *.pro
file:
QT += core
Upvotes: 3