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. Q_OBJECT macro not working
QtWS25 Last Chance

Q_OBJECT macro not working

Scheduled Pinned Locked Moved Unsolved General and Desktop
qobjectvscodecmake
4 Posts 3 Posters 490 Views
  • 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.
  • U Offline
    U Offline
    ugo_
    wrote on 23 Feb 2023, 11:58 last edited by
    #1

    I am using cmake and vscode, i can't get MOC to work, details in this SO link: https://stackoverflow.com/questions/75544361/q-object-label-not-working-undefined-reference-to-vtable

    J 1 Reply Last reply 23 Feb 2023, 12:16
    0
    • U ugo_
      23 Feb 2023, 11:58

      I am using cmake and vscode, i can't get MOC to work, details in this SO link: https://stackoverflow.com/questions/75544361/q-object-label-not-working-undefined-reference-to-vtable

      J Offline
      J Offline
      JonB
      wrote on 23 Feb 2023, 12:16 last edited by
      #2

      @ugo_
      Did you delete out all the files in the build output directory, and re-run cmake followed by building the project for the first time?

      U 1 Reply Last reply 23 Feb 2023, 13:01
      0
      • J JonB
        23 Feb 2023, 12:16

        @ugo_
        Did you delete out all the files in the build output directory, and re-run cmake followed by building the project for the first time?

        U Offline
        U Offline
        ugo_
        wrote on 23 Feb 2023, 13:01 last edited by
        #3

        @JonB I solved the issue by including the header in the add_executable command, which by the way I consider a very ugly way to do it, do you know any other way?

        J 1 Reply Last reply 23 Feb 2023, 13:08
        0
        • U ugo_
          23 Feb 2023, 13:01

          @JonB I solved the issue by including the header in the add_executable command, which by the way I consider a very ugly way to do it, do you know any other way?

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 23 Feb 2023, 13:08 last edited by J.Hilk
          #4

          @ugo_ I'm failing to see CMAKE_AUTOMOC in your cmake file, did you forget to enable moc for your project?

          Nope, I'm just blind :D


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0

          4/4

          23 Feb 2023, 13:08

          • Login

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