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.1k 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!

    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
                • JonBJ JonB

                  @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 Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by
                  #33

                  @JonB it is wrong and should be changed since gcc(not g++) will be applied for it.

                  JonBJ 1 Reply Last reply
                  0
                  • JoeCFDJ JoeCFD

                    @JonB it is wrong and should be changed since gcc(not g++) will be applied for it.

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

                    @JoeCFD
                    I'm guessing he has been using this for a while, seems strange this one and only error would show up now.

                    @SPlatten
                    I don't know whether this matters with gcc/g++. Do you want to show us the complete command-line being used to compile your config.c file?

                    JoeCFDJ SPlattenS 2 Replies Last reply
                    0
                    • JonBJ JonB

                      @JoeCFD
                      I'm guessing he has been using this for a while, seems strange this one and only error would show up now.

                      @SPlatten
                      I don't know whether this matters with gcc/g++. Do you want to show us the complete command-line being used to compile your config.c file?

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

                      @JonB with flag -x gcc will work for c++ code as well. But it is better to separate c and c++ code with .c and .cpp

                      1 Reply Last reply
                      1
                      • JoeCFDJ JoeCFD

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

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

                          @JoeCFD
                          I'm guessing he has been using this for a while, seems strange this one and only error would show up now.

                          @SPlatten
                          I don't know whether this matters with gcc/g++. Do you want to show us the complete command-line being used to compile your config.c file?

                          SPlattenS Offline
                          SPlattenS Offline
                          SPlatten
                          wrote on last edited by
                          #37
                          This post is deleted!
                          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....

                            SPlattenS Offline
                            SPlattenS Offline
                            SPlatten
                            wrote on last edited by
                            #38

                            @JonB , sorry to do this, can you please delete any posts where you have quoted my text or edit to remove quoted text. I am in trouble as I have mentioned project names in my posts that I should not have and as a result my contract has been terminated.

                            Thank you,
                            Simon

                            JonBJ 1 Reply Last reply
                            0
                            • SPlattenS SPlatten

                              @JonB , sorry to do this, can you please delete any posts where you have quoted my text or edit to remove quoted text. I am in trouble as I have mentioned project names in my posts that I should not have and as a result my contract has been terminated.

                              Thank you,
                              Simon

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

                              @SPlatten I have PMed you.....

                              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