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. Can't find linker symbol for virtual table
Qt 6.11 is out! See what's new in the release blog

Can't find linker symbol for virtual table

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 6 Posters 4.5k Views 3 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #11

    @wojj can you upload code somewhere so we can try to reproduce that issue?

    wojjW 1 Reply Last reply
    0
    • ? A Former User

      @wojj can you upload code somewhere so we can try to reproduce that issue?

      wojjW Offline
      wojjW Offline
      wojj
      wrote on last edited by
      #12

      @casdevel All code is in my first post. It's very simple example.

      1 Reply Last reply
      0
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on last edited by
        #13

        We need to see one of [b,c,d,e].cpp, where is the constructor ?

        wojjW 1 Reply Last reply
        0
        • mranger90M mranger90

          We need to see one of [b,c,d,e].cpp, where is the constructor ?

          wojjW Offline
          wojjW Offline
          wojj
          wrote on last edited by
          #14

          @mranger90 Constructors are empty. All for ClassB,C,D,E,F looks the same

          ClassB::ClassB(QObject *parent) : QObject(parent)
          {
          
          }
          
          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #15

            @wojj

            All code is in my first post. It's very simple example.

            It's part of the code, not all. Maybe example is simple but problem is obviously not, otherwise it would already be solved.
            I think your best bet for solving this would be to upload complete project.

            wojjW 1 Reply Last reply
            0
            • ? A Former User

              @wojj

              All code is in my first post. It's very simple example.

              It's part of the code, not all. Maybe example is simple but problem is obviously not, otherwise it would already be solved.
              I think your best bet for solving this would be to upload complete project.

              wojjW Offline
              wojjW Offline
              wojj
              wrote on last edited by
              #16

              @casdevel All code below. In my first post I described how to get gdb warning.
              Main

              #include <QApplication>
              
              #include "classa.h"
              
              int main(int argc, char *argv[])
              {
                  QApplication a(argc, argv);
                  ClassA *pA = new ClassA();
              
                  return a.exec();
              }
              

              H files

              #ifndef CLASSA_H
              #define CLASSA_H
              
              #include <QObject>
              
              #include "classb.h"
              #include "classc.h"
              #include "classd.h"
              #include "classe.h"
              #include "classf.h"
              
              class ClassA : public QObject
              {
                  Q_OBJECT
              
              public:
                  explicit ClassA(QObject *parent = nullptr);
                  ~ClassA();
              
              private:
                  ClassB *pB;
                  ClassC *pC;
                  ClassD *pD;
                  ClassE *pE;
                  ClassF *pF;
              
              
              
              signals:
              
              public slots:
              };
              
              #endif // CLASSA_H
              
              
              
              #ifndef CLASSB_H
              #define CLASSB_H
              
              #include <QObject>
              
              class ClassB : public QObject
              {
                  Q_OBJECT
              
              public:
                  explicit ClassB(QObject *parent = nullptr);
                  ~ClassB();
              
              signals:
              
              public slots:
              };
              
              #endif // CLASSB_H
              
              
              
              
              #ifndef CLASSC_H
              #define CLASSC_H
              
              #include <QObject>
              
              class ClassC : public QObject
              {
                  Q_OBJECT
              
              public:
                  explicit ClassC(QObject *parent = nullptr);
                  ~ClassC();
              
              signals:
              
              public slots:
              };
              
              #endif // CLASSC_H
              
              
              
              
              
              #ifndef CLASSD_H
              #define CLASSD_H
              
              #include <QObject>
              
              class ClassD : public QObject
              {
                  Q_OBJECT
              
              public:
                  explicit ClassD(QObject *parent = nullptr);
                  ~ClassD();
              
              signals:
              
              public slots:
              };
              
              #endif // CLASSD_H
              
              
              
              
              #ifndef CLASSE_H
              #define CLASSE_H
              
              #include <QObject>
              
              class ClassE : public QObject
              {
                  Q_OBJECT
              
              public:
                  explicit ClassE(QObject *parent = nullptr);
                  ~ClassE();
              
              signals:
              
              public slots:
              };
              
              #endif // CLASSE_H
              
              
              
              
              #ifndef CLASSF_H
              #define CLASSF_H
              
              #include <QObject>
              
              class ClassF : public QObject
              {
                  Q_OBJECT
              
              public:
                  explicit ClassF(QObject *parent = nullptr);
                  ~ClassF();
              
              signals:
              
              public slots:
              };
              
              #endif // CLASSF_H
              
              

              cpp files

              #include "classa.h"
              
              ClassA::ClassA(QObject *parent) : QObject(parent), pB(nullptr), pC(nullptr), pD(nullptr), pE(nullptr), pF(nullptr)
              {
                  pB = new ClassB();
                  pC = new ClassC();
                  pD = new ClassD();
                  pE = new ClassE();
                  pF = new ClassF();
              }
              
              ClassA::~ClassA()
              {
              
              }
              
              
              #include "classb.h"
              
              ClassB::ClassB(QObject *parent) : QObject(parent)
              {
              
              }
              
              ClassB::~ClassB()
              {
              
              }
              
              
              
              #include "classc.h"
              
              ClassC::ClassC(QObject *parent) : QObject(parent)
              {
              
              }
              
              ClassC::~ClassC()
              {
              
              }
              
              
              
              #include "classd.h"
              
              ClassD::ClassD(QObject *parent) : QObject(parent)
              {
              
              }
              
              ClassD::~ClassD()
              {
              
              }
              
              
              
              #include "classe.h"
              
              ClassE::ClassE(QObject *parent) : QObject(parent)
              {
              
              }
              
              ClassE::~ClassE()
              {
              
              }
              
              
              
              #include "classf.h"
              
              ClassF::ClassF(QObject *parent) : QObject(parent)
              {
              
              }
              
              ClassF::~ClassF()
              {
              
              }
              
              
              1 Reply Last reply
              0
              • wojjW Offline
                wojjW Offline
                wojj
                wrote on last edited by
                #17

                And .pro file

                #-------------------------------------------------
                #
                # Project created by QtCreator 2018-02-09T17:35:19
                #
                #-------------------------------------------------
                
                QT       += core gui
                
                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                
                TARGET = Test
                TEMPLATE = app
                
                # The following define makes your compiler emit warnings if you use
                # any feature of Qt which has been marked as deprecated (the exact warnings
                # depend on your compiler). Please consult the documentation of the
                # deprecated API in order to know how to port your code away from it.
                #DEFINES += QT_DEPRECATED_WARNINGS
                
                # You can also make your code fail to compile if you use deprecated APIs.
                # In order to do so, uncomment the following line.
                # You can also select to disable deprecated APIs only up to a certain version of Qt.
                #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                
                
                SOURCES += \
                        main.cpp \
                    classa.cpp \
                    classb.cpp \
                    classc.cpp \
                    classd.cpp \
                    classe.cpp \
                    classf.cpp
                
                HEADERS += \
                    classa.h \
                    classb.h \
                    classc.h \
                    classd.h \
                    classe.h \
                    classf.h
                
                
                1 Reply Last reply
                1
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #18

                  OK, I get the same warning as you if I use Qt 5.10.0, but with older Qt 5.5.1 there is no warning. I didn't investigate why since
                  app is running fine and debugging also working correctly (apart from that warning) with both Qt versions.

                  I think that you can safely ignore this warning since everything is working correctly.

                  jsulmJ 1 Reply Last reply
                  3
                  • ? A Former User

                    OK, I get the same warning as you if I use Qt 5.10.0, but with older Qt 5.5.1 there is no warning. I didn't investigate why since
                    app is running fine and debugging also working correctly (apart from that warning) with both Qt versions.

                    I think that you can safely ignore this warning since everything is working correctly.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by jsulm
                    #19

                    @casdevel @wojj Would be worth to file a bug report to get rid of this warning.
                    And sometimes warnings actually point to real issues :-)

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    2
                    • wojjW Offline
                      wojjW Offline
                      wojj
                      wrote on last edited by
                      #20

                      Thank you for help. The problem seems to be related to Qt version in that case.
                      Best regards.

                      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