我正在从以前使用 Qt 5.6 构建的项目中移植源代码,现在我正在更新到 5.11
尝试构建项目时出现错误:
'QJSEngine' file not found
在我的消息来源中:
#include <QtGlobal>
#include <QDateTime>
#include <QDesktopWidget>
#include <QDebug>
#include <QJSEngine>
#include <QKeyEvent>
#include <QList>
#include <QObject>
#include <QPainter>
#include <QPainterPath>
#include <QMainWindow>
#include <QMutex>
#include <QScreen>
#include <QString>
#include <QTimer>
#include <QUrl>
#include <QWidget>
在我使用的函数中:
QJSEngine engine;
QJSValue objResult = engine.evaluate(strExpression);
Qt Creator 关于信息:
Qt Creator 4.8.0-beta (4.7.82)
Based on Qt 5.11.2 (Clang 8.0 (Apple), 64 bit)
Built on Oct 10 2018 05:23:06
From revision 4801348a31
关于我的 iMac:
macOS Mojave
version 10.14
iMac (Retina 5K, 27-inch, Late 2015)
Processor 4GHz Intel Core i7
Memory 16 GB 1867 MHz DDR3
Graphics AMD Radeon R9 M395X 4096 MB
我也在以前的 Qt Creator 版本上尝试过,结果相同。
这是专业文件:
#-------------------------------------------------
#
# Project created by QtCreator 2018-10-15T09:17:31
#
#-------------------------------------------------
QT += core gui widgets
TARGET = XMLMPAM
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
main.cpp \
clsMainWnd.cpp
HEADERS += \
clsMainWnd.h
FORMS += \
clsMainWnd.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
clsmainwnd.qrc