Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. cmake project configured incorrectly
Forum Updated to NodeBB v4.3 + New Features

cmake project configured incorrectly

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 2 Posters 2.2k Views 2 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.
  • dacresniD Offline
    dacresniD Offline
    dacresni
    wrote on last edited by dacresni
    #1

    I'm trying write a QML project with C++ objects exposed in it and I think i've configured my QtCreator wrong because my first use of Q_PROPERTY has a syntax error of "unexpected token '(' " and when I compile, i get "undefined reference to vtable for DbHost" (which is my C++ class name) I think i've configured my project wrong but I don't know how wrong. My project is in my githubrepo

    1 Reply Last reply
    0
    • dacresniD Offline
      dacresniD Offline
      dacresni
      wrote on last edited by dacresni
      #2

      When I comment out my type registration it compiles just fine

      // qmlRegisterType<DBHost>("io.github.dacresni", 1, 0,"DBHost");

      1 Reply Last reply
      0
      • dacresniD Offline
        dacresniD Offline
        dacresni
        wrote on last edited by
        #3

        and when i comment out both macros i get the error
        /usr/include/qt5/QtQml/qqmlprivate.h:99: error: undefined reference to `DBHosts::DBHosts(QObject*)'

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          You’re not compiling all of your sources.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          dacresniD 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            You’re not compiling all of your sources.

            dacresniD Offline
            dacresniD Offline
            dacresni
            wrote on last edited by
            #5

            @SGaist how do i change that? Im on linux; Fedora 27 and I have qt installed by both package manager and via the Qt Mantainance tool.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              It’s not a Qt problem, you don’t list all the sources for your application. You have only put main.cpp.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • dacresniD Offline
                dacresniD Offline
                dacresni
                wrote on last edited by
                #7

                I'm new to QtCreator and I'm not sure the problem is in my Cmake file , my project settings or my build kits.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  As I already wrote, your CMakeList file is wrong. In add_executable, you are only listing main.cpp. So you are not compiling all your other classes hence the error you are getting.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  dacresniD 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    As I already wrote, your CMakeList file is wrong. In add_executable, you are only listing main.cpp. So you are not compiling all your other classes hence the error you are getting.

                    dacresniD Offline
                    dacresniD Offline
                    dacresni
                    wrote on last edited by dacresni
                    #9

                    @SGaist said in cmake project configured incorrectly:

                    add_executable

                    OH! now i understand. my Cmake file needs hostslist.cpp and hostslist.h

                    dacresniD 1 Reply Last reply
                    0
                    • dacresniD dacresni

                      @SGaist said in cmake project configured incorrectly:

                      add_executable

                      OH! now i understand. my Cmake file needs hostslist.cpp and hostslist.h

                      dacresniD Offline
                      dacresniD Offline
                      dacresni
                      wrote on last edited by
                      #10

                      @dacresni @SGaist and that did it! thank you!

                      1 Reply Last reply
                      1

                      • Login

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