Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] DEPENDPATH and INCLUDEPATH
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] DEPENDPATH and INCLUDEPATH

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 17.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QMartin
    wrote on last edited by
    #1

    Hello guys

    I'm having trouble with the .pro file. I have one external sub-classed QDialog and I want to start it when I select one action from the menu bar. When in my .pro file I specify the INCLUDEPATH with the HEADERS directory like this:

    @#-------------------------------------------------

    Project created by QtCreator 2012-11-28T09:23:03

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = myApp
    TEMPLATE = app

    INCLUDEPATH = /home/martin/myDialog

    SOURCES += main.cpp
    mainwindow.cpp
    /home/martin/myDialog/myDialog.cpp

    RESOURCES = resources.qrc

    HEADERS += mainwindow.h
    myDialog.h@

    I get the next message 4 times after compiling:

    @undefined reference to 'vtable for myDialog'@

    I know its something about the linker, but when I specify the .pro like this:

    @#-------------------------------------------------

    Project created by QtCreator 2012-11-28T09:23:03

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = myApp
    TEMPLATE = app

    DEPENDPATH += /home/martin/myDialog

    INCLUDEPATH = /home/martin/myDialog

    SOURCES += main.cpp
    mainwindow.cpp
    myDialog.cpp

    RESOURCES = resources.qrc

    HEADERS += mainwindow.h
    myDialog.h@

    Everything works fine. I've read "qmake variables documentation":http://doc.qt.digia.com/qt/qmake-variable-reference.html but could not understand why I need the DEPENDPATH variable even though with INCLUDEPATH I specify headers and SOURCES afterwards. Any ideas?

    Thanks in advance!

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      QMartin
      wrote on last edited by
      #2

      Hello guys!

      I think I found the answer. The reason: I read "this post":http://qt-project.org/forums/viewthread/11447 Then realized that myDialog.cpp had dependencies inside its directory (I suppose these are the moc files from Q_OBJECT of myDialog.cpp). So I need DEPENDPATH, to resolve dependencies where specified. When DEPENDPATH is not defined, no moc_myDialog.cpp file is created.

      I think this is it, because it also worked with VPATH variable:
      @
      #-------------------------------------------------

      Project created by QtCreator 2012-11-28T09:23:03

      #-------------------------------------------------

      QT += core gui

      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

      TARGET = myApp
      TEMPLATE = app

      VPATH = /home/martin/myDialog

      INCLUDEPATH = /home/martin/myDialog

      SOURCES += main.cpp
      mainwindow.cpp
      myDialog.cpp

      RESOURCES = resources.qrc

      HEADERS += mainwindow.h
      myDialog.h@

      Regards.

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

        The error you described mostly comes from changes in your project file, but forgot to run the qmake again.
        But if you fix did the trick I might be wrong ;-)

        Greetz, Jeroen

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved