在这个QT自动生成的Makefile中,moc,rcc和uic调用在哪里?

时间:2018-02-16 14:37:48

标签: qt

Qt文档站点:

  

如果您使用qmake创建makefile,则会包含在需要时调用moc的构建规则,因此您不需要直接使用moc。

所以我遵循官方最小申请tutorial,并创建了:

// hello.cpp:

#include <QtGui>
#include <QApplication>
#include <QLabel>

int main(int argc, char **argv) {
 QApplication app(argc, argv);
 QLabel label("Hello, world!");
 label.show();
 return app.exec();
}

qmake -project

将此添加到QtProject.pro:

...
INCLUDEPATH += .

QT += gui
QT += widgets

...

qmake,我得到了这个Makefile:

 #############################################################################
 # Makefile for building: QtSample
 # Generated by qmake (3.1) (Qt 5.10.1)
 # Project:  QtSample.pro
 # Template: app
 # Command: /home/roman/Qt/5.10.1/gcc_64/bin/qmake -o Makefile QtSample.pro
 #############################################################################

 MAKEFILE      = Makefile

 ####### Compiler, tools and options

 CC            = gcc
 CXX           = g++
 DEFINES       = -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
 CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
 CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
 INCPATH       = -I. -I. -I../../Qt/5.10.1/gcc_64/include -I../../Qt/5.10.1/gcc_64/include/QtWidgets -I../../Qt/5.10.1/gcc_64/include/QtGui -I../../Qt/5.10.1/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I../../Qt/5.10.1/gcc_64/mkspecs/linux-g++
 QMAKE         = /home/roman/Qt/5.10.1/gcc_64/bin/qmake
 DEL_FILE      = rm -f
 CHK_DIR_EXISTS= test -d
 MKDIR         = mkdir -p
 COPY          = cp -f
 COPY_FILE     = cp -f
 COPY_DIR      = cp -f -R
 INSTALL_FILE  = install -m 644 -p
 INSTALL_PROGRAM = install -m 755 -p
 INSTALL_DIR   = cp -f -R
 QINSTALL      = /home/roman/Qt/5.10.1/gcc_64/bin/qmake -install qinstall
 QINSTALL_PROGRAM = /home/roman/Qt/5.10.1/gcc_64/bin/qmake -install qinstall -exe
 DEL_FILE      = rm -f
 SYMLINK       = ln -f -s
 DEL_DIR       = rmdir
 MOVE          = mv -f
 TAR           = tar -cf
 COMPRESS      = gzip -9f
 DISTNAME      = QtSample1.0.0
 DISTDIR = /home/roman/Documents/QtSample/.tmp/QtSample1.0.0
 LINK          = g++
 LFLAGS        = -Wl,-O1 -Wl,-rpath,/home/roman/Qt/5.10.1/gcc_64/lib
 LIBS          = $(SUBLIBS) -L/home/roman/Qt/5.10.1/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
 AR            = ar cqs
 RANLIB        = 
 SED           = sed
 STRIP         = strip

 ####### Output directory

 OBJECTS_DIR   = ./

 ####### Files

 SOURCES       = hello.cpp 
 OBJECTS       = hello.o
 DIST          = ../../Qt/5.10.1/gcc_64/mkspecs/features/spec_pre.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/unix.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/linux.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/sanitize.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/qt_functions.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/qt_config.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/linux-g++/qmake.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/spec_post.prf \
        .qmake.stash \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/exclusive_builds.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/toolchain.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/default_pre.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/resolve_config.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/default_post.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/warn_on.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/qt.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/resources.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/moc.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/unix/opengl.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/uic.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/unix/thread.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/qmake_use.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/file_copies.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/testcase_targets.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/exceptions.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/yacc.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/lex.prf \
        QtSample.pro  hello.cpp
 QMAKE_TARGET  = QtSample
 DESTDIR       = 
 TARGET        = QtSample


 first: all
 ####### Build rules

 $(TARGET):  $(OBJECTS)  
    $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

 Makefile: QtSample.pro ../../Qt/5.10.1/gcc_64/mkspecs/linux-g++/qmake.conf ../../Qt/5.10.1/gcc_64/mkspecs/features/spec_pre.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/unix.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/linux.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/sanitize.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/gcc-base.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/gcc-base-unix.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/g++-base.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/common/g++-unix.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/qconfig.pri \
        ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3danimation.pri \
                    ../../Qt/5.10.1/gcc_64/mkspecs/linux-g++/qmake.conf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/spec_post.prf \
        .qmake.stash \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/exclusive_builds.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/toolchain.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/default_pre.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/resolve_config.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/default_post.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/warn_on.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/qt.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/resources.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/moc.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/unix/opengl.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/uic.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/unix/thread.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/qmake_use.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/file_copies.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/testcase_targets.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/exceptions.prf \

        #### Had to cut out some files here due to SO website limitations


        ../../Qt/5.10.1/gcc_64/mkspecs/features/yacc.prf \
        ../../Qt/5.10.1/gcc_64/mkspecs/features/lex.prf \
        QtSample.pro \
        ../../Qt/5.10.1/gcc_64/lib/libQt5Widgets.prl \
        ../../Qt/5.10.1/gcc_64/lib/libQt5Gui.prl \
        ../../Qt/5.10.1/gcc_64/lib/libQt5Core.prl
    $(QMAKE) -o Makefile QtSample.pro
 ../../Qt/5.10.1/gcc_64/mkspecs/features/spec_pre.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/unix.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/linux.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/sanitize.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/gcc-base.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/gcc-base-unix.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/g++-base.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/common/g++-unix.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/qconfig.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3danimation.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3danimation_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dcore.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dcore_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dextras.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dextras_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dinput.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dinput_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dlogic.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dlogic_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquick.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquick_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickanimation_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickextras_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickinput_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickrender_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3dquickscene2d_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3drender.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_3drender_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_accessibility_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_bluetooth.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_bluetooth_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_bootstrap_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_concurrent.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_concurrent_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_core.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_core_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_dbus.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_dbus_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_designer.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_designer_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_designercomponents_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_edid_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_egl_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_fb_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_fontdatabase_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_gamepad.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_gamepad_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_glx_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_gui.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_gui_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_help.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_help_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_input_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_kms_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_location.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_location_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_multimedia.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_multimedia_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_multimediagsttools_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_multimediawidgets_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_network.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_network_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_nfc.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_nfc_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_opengl.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_opengl_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_openglextensions.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_openglextensions_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_packetprotocol_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_platformcompositor_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_positioning.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_positioning_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_printsupport.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_printsupport_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qml.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qml_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qmldebug_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qmldevtools_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qmltest.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qmltest_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quick.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quick_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quickparticles_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_quickwidgets_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_scxml.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_scxml_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_sensors.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_sensors_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_serialbus.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_serialbus_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_serialport.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_serialport_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_service_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_sql.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_sql_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_svg.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_svg_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_testlib.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_testlib_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_texttospeech.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_texttospeech_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_theme_support_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_uiplugin.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_uitools.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_uitools_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_webchannel.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_webchannel_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_websockets.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_websockets_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_webview.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_webview_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_widgets.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_widgets_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_x11extras.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_x11extras_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_xml.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_xml_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/qt_functions.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/qt_config.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/linux-g++/qmake.conf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/spec_post.prf:
 .qmake.stash:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/exclusive_builds.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/toolchain.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/default_pre.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/resolve_config.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/default_post.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/warn_on.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/qt.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/resources.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/moc.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/unix/opengl.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/uic.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/unix/thread.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/qmake_use.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/file_copies.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/testcase_targets.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/exceptions.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/yacc.prf:
 ../../Qt/5.10.1/gcc_64/mkspecs/features/lex.prf:
 QtSample.pro:
 ../../Qt/5.10.1/gcc_64/lib/libQt5Widgets.prl:
 ../../Qt/5.10.1/gcc_64/lib/libQt5Gui.prl:
 ../../Qt/5.10.1/gcc_64/lib/libQt5Core.prl:
 qmake: FORCE
    @$(QMAKE) -o Makefile QtSample.pro

 qmake_all: FORCE


 all: Makefile $(TARGET)

 dist: distdir FORCE
    (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)

 distdir: FORCE
    @test -d $(DISTDIR) || mkdir -p $(DISTDIR)
    $(COPY_FILE) --parents $(DIST) $(DISTDIR)/
    $(COPY_FILE) --parents ../../Qt/5.10.1/gcc_64/mkspecs/features/data/dummy.cpp $(DISTDIR)/
    $(COPY_FILE) --parents hello.cpp $(DISTDIR)/


 clean: compiler_clean 
    -$(DEL_FILE) $(OBJECTS)
    -$(DEL_FILE) *~ core *.core


 distclean: clean 
    -$(DEL_FILE) $(TARGET) 
    -$(DEL_FILE) .qmake.stash
    -$(DEL_FILE) Makefile


 ####### Sub-libraries

 mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean

 mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all

 check: first

 benchmark: first

 compiler_rcc_make_all:
 compiler_rcc_clean:
 compiler_moc_predefs_make_all: moc_predefs.h
 compiler_moc_predefs_clean:
    -$(DEL_FILE) moc_predefs.h
 moc_predefs.h: ../../Qt/5.10.1/gcc_64/mkspecs/features/data/dummy.cpp
    g++ -pipe -O2 -Wall -W -dM -E -o moc_predefs.h ../../Qt/5.10.1/gcc_64/mkspecs/features/data/dummy.cpp

 compiler_moc_header_make_all:
 compiler_moc_header_clean:
 compiler_moc_objc_header_make_all:
 compiler_moc_objc_header_clean:
 compiler_moc_source_make_all:
 compiler_moc_source_clean:
 compiler_uic_make_all:
 compiler_uic_clean:
 compiler_yacc_decl_make_all:
 compiler_yacc_decl_clean:
 compiler_yacc_impl_make_all:
 compiler_yacc_impl_clean:
 compiler_lex_make_all:
 compiler_lex_clean:
 compiler_clean: compiler_moc_predefs_clean 

 ####### Compile

 hello.o: hello.cpp ../../Qt/5.10.1/gcc_64/include/QtGui/QtGui \
        ../../Qt/5.10.1/gcc_64/include/QtGui/QtGuiDepends \
        ../../Qt/5.10.1/gcc_64/include/QtCore/QtCore \
        ../../Qt/5.10.1/gcc_64/include/QtCore/QtCoreDepends \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qglobal.h \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qconfig-bootstrapped.h \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qconfig.h \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qtcore-config.h \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qsystemdetection.h \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qprocessordetection.h \
        ../../Qt/5.10.1/gcc_64/include/QtCore/qcompilerdetection.h \

        #### Had to cut out some files here due to SO website limitations

        ../../Qt/5.10.1/gcc_64/include/QtCore/QSize \
        ../../Qt/5.10.1/gcc_64/include/QtCore/QSizeF \
        ../../Qt/5.10.1/gcc_64/include/QtGui/QTransform \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qsessionmanager.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qstandarditemmodel.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qstatictext.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qstylehints.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qsyntaxhighlighter.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qtextobject.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qtextdocumentfragment.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qtextdocumentwriter.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qtextlist.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qtexttable.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qvalidator.h \
        ../../Qt/5.10.1/gcc_64/include/QtGui/qtguiversion.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/QApplication \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qapplication.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qtwidgetsglobal.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qtwidgets-config.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qdesktopwidget.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qwidget.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qsizepolicy.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/QLabel \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qlabel.h \
        ../../Qt/5.10.1/gcc_64/include/QtWidgets/qframe.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o hello.o hello.cpp

 ####### Install

 install:  FORCE

 uninstall:  FORCE

 FORCE:

但我无法看到mocrccuic次调用。他们在哪儿?

1 个答案:

答案 0 :(得分:1)

您的项目不包含任何QObject派生的自定义类,因此无需运行moc

最小示例(mywidget.h):

#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>

class MyWidget: public QWidget {
  Q_OBJECT
};

#endif

和您修改后的hello.cpp

#include <QtGui>
#include <QApplication>

#include "mywidget.h"

int main(int argc, char **argv) {
  QApplication app(argc, argv);
  MyWidget w;
  w.show();
  return app.exec();
}

如果您现在运行qmake -projectqmake,则生成的Makefile将包含对moc的调用,例如

...
moc_mywidget.cpp: mywidget.h \
    moc_predefs.h \
    /usr/lib/x86_64-linux-gnu/qt5/bin/moc
/usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/tmp/qt -I/tmp/qt -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/7 -I/usr/include/x86_64-linux-gnu/c++/7 -I/usr/include/c++/7/backward -I/usr/lib/gcc/x86_64-linux-gnu/7/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include mywidget.h -o moc_mywidget.cpp
....