我正试图在VS上构建一个C++项目。该项目是在Linux机器上使用NetBeans开发的,现在我在Windows上使用VisualStudio2017。
它不是使用sentences开发的,所以库是手动添加的,如下所示:
#include <QtCore>
#include <QCoreApplication>
#include <QObject>
#include <QStringList>
#include <QMap>
...这就是我迄今为止所做的:
然而,当我尝试#include <QtCore>时,VS似乎期望更多的东西:https://imgur.com/a/ruSbi
但它不编译。
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "QEvent" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qabstractanimation.h 121
Error (active) E0020 identifier "QEvent" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qabstractstate.h 73
Error (active) E0020 identifier "QEvent" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qabstractstate.h 74
Error (active) E0020 identifier "QEvent" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qabstractstate.h 76
Error (active) E1455 member function declared with 'override' does not override a base class member c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qabstracttransition.h 105
Error (active) E1455 member function declared with 'override' does not override a base class member c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qanimationgroup.h 70
Error (active) E1455 member function declared with 'override' does not override a base class member c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qcoreapplication.h 190
Error (active) E0020 identifier "qint8" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qdatastream.h 147
Error (active) E0020 identifier "qint8" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qdatastream.h 163
Error (active) E0260 explicit type is missing ('int' assumed) c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qendian.h 236
Error (active) E0801 "qint8" is not a class or function template name in the current scope c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qendian.h 236
Error (active) E0065 expected a ';' c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qendian.h 236
Error (active) E0020 identifier "qint8" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qendian.h 236
Error (active) E0020 identifier "QEvent" is undefined c:\Qt\Qt5.9.2\5.9.2\msvc2017_64\include\QtCore\qeventloop.h 79
Error (active) E1455 member function declared with 'override' does not override a base class member
... 所以我想我漏掉了什么。我是VS的新手,所以我很感激你的帮助。
谢谢
发布于 2017-11-16 09:51:17
QtCore既是一个目录,也是一个包含文件:
Directory: <Qt_Install_Path>/include/QtCore
File: <Qt_Install_Path>/include/QtCore/QtCore此外,您还需要在每个包含Q_OBJECT宏的头上运行Qt Q_OBJECT。moc将生成额外的C++文件,您需要编译这些文件。当使用像qmake或cmake这样的工具时,它是相当简单的。对于VS,您可以使用Qt Visual Studio外接程序。
https://stackoverflow.com/questions/47324863
复制相似问题