我要求您提供有关QT的知识。
您知道为什么在编译过程中Moc文件无法从QT中找到包含内容吗?
我目前在Qt Project中有此问题,错误是
“ moc_SettingsDialog.cpp:9:在moc_SettingsDialog.cpp:9包含的文件中: SettingsDialog.h:12:错误:找不到“ QDialog”文件”。
这是我的专业文件:
#-------------------------------------------------
#
# Project created by QtCreator 2018-12-04T14:58:35
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = cashRegister
TEMPLATE = app
message($${INCLUDEPATH})
# 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 \
cashRegister.cpp \
sources/settings.cpp \
sources/settingsBuilder.cpp \
sources/parseConfFile.cpp \
sources/SupplyList.cpp \
sources/Item.cpp \
sources/SettingsDialog.cpp \
sources/TpeNetwork.cpp \
sources/ManagerNetwork.cpp \
sources/BillNetwork.cpp \
sources/PaymentServerNetwork.cpp \
sources/NetworkFactory.cpp \
sources/Customer.cpp \
sources/Cart.cpp
HEADERS += \
cashRegister.h \
includes/settings.h \
includes/settingsBuilder.h \
includes/parseConfFile.h \
includes/SupplyList.h \
includes/Item.h \
includes/Mybutton.h \
includes/SettingsDialog.h \
includes/TpeNetwork.h \
includes/ManagerNetwork.h \
includes/BillNetwork.h \
includes/PaymentServerNetwork.h \
includes/NetworkFactory.h \
includes/NetworkCode.h \
includes/networkabstract.h \
includes/networkinterface.hpp \
includes/Customer.h \
includes/Cart.h
FORMS += \
cashRegister.ui \
SettingsDialog.ui
macx {
_BOOST_PATH = /usr/local/Cellar/boost/1.68.0
INCLUDEPATH += "$${_BOOST_PATH}/include/"
LIBS += -L$${_BOOST_PATH}/lib -lboost_regex
}
unix:!macx {
LIBS += -L"/usr/lib/x86_64-linux-gnu" -lboost_regex
INCLUDEPATH += /usr/include/boost
DEPENDPATH += /usr/include/boost
DEFINES += QT_NO_VERSION_TAGGING
}
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
config.qrc
Qt版本:5.12.0 操作系统:MacOS 10.14和Ubuntu