How to build Qt project with auto tools

  • I have a project built from autotool and I would like to add an ui for it. I would like to combine Qt's stuff into my original project. I make a new Qt Designer Form Class with default setting, mainwindow.cpp, mainwindow.h and mainwindow.ui, but I don't know how to build it. Any one knows how to do it?

    File sturcture

    I have tried to add the following into

    # Check for Qt libraries
    PKG_CHECK_MODULES(QT, [QtCore, QtGui, QtNetwork], [], [AC_MSG_ERROR([Qt libraries are required.])])
    # Retrieve Qt compilation and linker flags
    CPPFLAGS="`$PKG_CONFIG --cflags-only-I QtCore QtGui QtNetwork` $CPPFLAGS"
    LDFLAGS="`$PKG_CONFIG --libs-only-L QtCore QtGui QtNetwork` $LDFLAGS"
    LIBS="`$PKG_CONFIG --libs-only-l QtCore QtGui QtNetwork` $LIBS"
    if ! `$PKG_CONFIG --atleast-version=4.6.0 QtCore`; then
       AC_MSG_ERROR([Qt >= 4.6.0 is required.])
    AC_CHECK_PROGS(MOC, [moc-qt5 moc-qt4 moc])
    AC_CHECK_PROGS(UIC, [uic-qt5 uic-qt4 uic])
    AC_CHECK_PROGS(RCC, [rcc])
     if test -z "$MOC" || test -z "$UIC" || test -z "$RCC"; then
       AC_MSG_ERROR([Qt utility programs moc, uic, and rcc are required.])

    I added the following into

    # qt project stuff
    moc_%.cpp: %.h
    ui_%.h: %.ui
    	@UIC@ -o $@ $<
    qrc_%.cpp: %.qrc
    	@RCC@ -o $@ $<

    But I get error

    undefined reference to `vtable for MainWindow'

    I found that people said those moc_ files are missing but I don't know how to fix it.

    Anyway, can anyone teach me how to build a Qt project with autotool?

  • Hi! Qt Creator has a plugin for working with Autotools ( Never used this myself but maybe it does what you want.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.