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. undefined reference to `vtable for
Qt 6.11 is out! See what's new in the release blog

undefined reference to `vtable for

Scheduled Pinned Locked Moved Unsolved General and Desktop
39 Posts 5 Posters 6.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.
  • SPlattenS SPlatten

    This post is deleted!

    J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by
    #13

    @SPlatten sooo, what exactly is at line 47 ?


    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.

    SPlattenS 1 Reply Last reply
    1
    • JoeCFDJ JoeCFD

      In this case, often you need to make clean and rebuild your project.
      in cmake: remove build fold completely. rebuild everything
      in qmake: make distclean. then rebuild.

      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #14
      This post is deleted!
      1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @SPlatten sooo, what exactly is at line 47 ?

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #15
        This post is deleted!
        JonBJ 1 Reply Last reply
        0
        • SPlattenS SPlatten

          This post is deleted!

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #16

          @SPlatten
          To be clear: you mean that the file you have been showing us is the config.H file of the error message? And the implementation file is config.cpp which is compiled to config.o. And the line #47

          staledata_t() : QObject(nullptr)
          

          is the one just under the public: you show earlier?

          SPlattenS 1 Reply Last reply
          0
          • SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #17
            This post is deleted!
            1 Reply Last reply
            0
            • JonBJ JonB

              @SPlatten
              To be clear: you mean that the file you have been showing us is the config.H file of the error message? And the implementation file is config.cpp which is compiled to config.o. And the line #47

              staledata_t() : QObject(nullptr)
              

              is the one just under the public: you show earlier?

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #18
              This post is deleted!
              JonBJ J.HilkJ JoeCFDJ 3 Replies Last reply
              0
              • SPlattenS SPlatten

                This post is deleted!

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #19

                @SPlatten
                Dunno at this point, a bit difficult to spot with all that's going on. For me I would do the usual: comment "everything" out, preferably including the namespaces, till you get rid of that message. Then add back in....

                1 Reply Last reply
                0
                • SPlattenS SPlatten

                  This post is deleted!

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #20

                  @SPlatten your class compiles perfectly fine for me, at least as long as I add the implementation of m_nextUDN, where exactly do you do that ?

                  I know you said/showed, you do it, but where exactly?


                  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.

                  SPlattenS 1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @SPlatten your class compiles perfectly fine for me, at least as long as I add the implementation of m_nextUDN, where exactly do you do that ?

                    I know you said/showed, you do it, but where exactly?

                    SPlattenS Offline
                    SPlattenS Offline
                    SPlatten
                    wrote on last edited by SPlatten
                    #21
                    This post is deleted!
                    JonBJ 2 Replies Last reply
                    0
                    • JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by
                      #22

                      Often make clean is not enough especially when cmake is used. Remove the whole build dir and recreate it.

                      1 Reply Last reply
                      1
                      • SPlattenS SPlatten

                        This post is deleted!

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #23

                        @SPlatten
                        Yeah, but is that "global scope", i.e. not inside anything else?

                        @J-Hilk
                        The trouble is, without m_nextUDN defined properly, I do not get

                        undefined reference to vtable for asv::scm::helm::staledata_t'

                        message, I get complaint about m_nextUDN not being defined....

                        J.HilkJ SPlattenS 2 Replies Last reply
                        0
                        • M Offline
                          M Offline
                          mchinand
                          wrote on last edited by
                          #24

                          Do the capital C/H extensions force compiling this with the c compiler instead of c++?

                          1 Reply Last reply
                          0
                          • JonBJ JonB

                            @SPlatten
                            Yeah, but is that "global scope", i.e. not inside anything else?

                            @J-Hilk
                            The trouble is, without m_nextUDN defined properly, I do not get

                            undefined reference to vtable for asv::scm::helm::staledata_t'

                            message, I get complaint about m_nextUDN not being defined....

                            J.HilkJ Offline
                            J.HilkJ Offline
                            J.Hilk
                            Moderators
                            wrote on last edited by J.Hilk
                            #25

                            @JonB yes, the error message probably changed after @SPlatten added the missing function body that the Q_PROPERTY macro referred to.

                            @SPlatten are you sure config.c is party of your project ? :D so the linker can find it


                            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.

                            JonBJ 1 Reply Last reply
                            0
                            • SPlattenS SPlatten

                              This post is deleted!

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by JonB
                              #26

                              @SPlatten
                              I'm with @JoeCFD on one thing: if you get "incomprehensible"/"impossible" error messages, especially about vtables, with Qt you (may) need to do a "change underpants"-type clean rebuild. Preferable buy a new machine ;-) But if not delete the whole build output directory and try again.....

                              1 Reply Last reply
                              0
                              • SPlattenS Offline
                                SPlattenS Offline
                                SPlatten
                                wrote on last edited by
                                #27
                                This post is deleted!
                                J.HilkJ 1 Reply Last reply
                                0
                                • J.HilkJ J.Hilk

                                  @JonB yes, the error message probably changed after @SPlatten added the missing function body that the Q_PROPERTY macro referred to.

                                  @SPlatten are you sure config.c is party of your project ? :D so the linker can find it

                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on last edited by JonB
                                  #28

                                  @SPlatten

                                  @J-Hilk said in undefined reference to `vtable for:

                                  @SPlatten are you sure config.c is party of your project ? :D so the linker can find it

                                  ?? Look at actual linker statement being executed?

                                  Hmm, originally you showed

                                  .build/config.o: In function asv::scm::helm::staledata_t::staledata_t()':

                                  immediately above the undefined reference to vtable message. Is that still present? Because that does imply the linker is trying to pull in config.o, which would imply it does appear on the linker command line.... Is that indeed the right .build/config.o path for the config.o you keep rebuilding?

                                  1 Reply Last reply
                                  0
                                  • SPlattenS SPlatten

                                    This post is deleted!

                                    J.HilkJ Offline
                                    J.HilkJ Offline
                                    J.Hilk
                                    Moderators
                                    wrote on last edited by
                                    #29

                                    @SPlatten

                                    soooo, since you'e not using m_nextUDN anywhere else and its private.... have you considered simply using:

                                    static uint16_t nextUDN() {
                                            static uint16_t m_nextUDN = 0;
                                            return ++(m_nextUDN);
                                        }
                                    

                                    ?


                                    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.

                                    SPlattenS 1 Reply Last reply
                                    0
                                    • J.HilkJ J.Hilk

                                      @SPlatten

                                      soooo, since you'e not using m_nextUDN anywhere else and its private.... have you considered simply using:

                                      static uint16_t nextUDN() {
                                              static uint16_t m_nextUDN = 0;
                                              return ++(m_nextUDN);
                                          }
                                      

                                      ?

                                      SPlattenS Offline
                                      SPlattenS Offline
                                      SPlatten
                                      wrote on last edited by SPlatten
                                      #30
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • SPlattenS SPlatten

                                        This post is deleted!

                                        JoeCFDJ Offline
                                        JoeCFDJ Offline
                                        JoeCFD
                                        wrote on last edited by JoeCFD
                                        #31

                                        @SPlatten not config.cpp or config.cc? it is not c code, right?

                                        JonBJ SPlattenS 2 Replies Last reply
                                        1
                                        • JoeCFDJ JoeCFD

                                          @SPlatten not config.cpp or config.cc? it is not c code, right?

                                          JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote on last edited by
                                          #32

                                          @JoeCFD
                                          It it were compiled as C code, it wouldn't begin to compile :) So I think we can assume whatever his file extension it's being compiled as C++!

                                          JoeCFDJ 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