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:
我正在尝试创建一个使用QT创建者的dll。我去了一个新项目-> libary -> c++ libary ->选择。它自动生成一个带有全局前缀的头文件,其中包括无法找到的include头:
#include <QtCore/qglobal.h>
give the error:
给错误:
error: QtGlobal: No such file or directory
错误:QtGlobal:没有这样的文件或目录。
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.
我发现这个标题被包含在Q_DECL_EXPORT宏中,所以我搜索了这个定义的位置:这里。所以我做了#include
What's the source of error and how can I fix this?
错误的来源是什么?我该如何解决这个问题?
3 个解决方案
#1
2
You probably need to add the following to your *.pro
file:
您可能需要将以下内容添加到*中。支持文件:
QT += core
#2
1
Found the solution!
找到解决方案!
The QT creator created the project with the following line in the .pro
file:
QT创建者在.pro文件中创建了这个项目。
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.
注意-=操作符,这阻止了核心库的链接,然后没有发现#include
#3
0
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创建者在.pro文件中创建了这个项目:我必须删除/注释掉下面的整个行。
# QT -= core gui
#1
2
You probably need to add the following to your *.pro
file:
您可能需要将以下内容添加到*中。支持文件:
QT += core
#2
1
Found the solution!
找到解决方案!
The QT creator created the project with the following line in the .pro
file:
QT创建者在.pro文件中创建了这个项目。
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.
注意-=操作符,这阻止了核心库的链接,然后没有发现#include
#3
0
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创建者在.pro文件中创建了这个项目:我必须删除/注释掉下面的整个行。
# QT -= core gui