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
QtWS25 Last Chance

Can't find linker symbol for virtual table

Scheduled Pinned Locked Moved General and Desktop
17 Posts 7 Posters 17.3k 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.
  • P Offline
    P Offline
    poporacer
    wrote on last edited by
    #3

    Yes it was a typo when I posted the code. The variable is declared. I changed the above posted code to correct how it should have read.

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #4

      But does it also point to a valid object? If it wasn't declared it woudl not compile. If it is declared but pointing at random memory you could get a crash like you are seeing.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #5

        initialise the variable at top of constructor to 0. The you will see if it's initialised properly

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #6

          There is no variable printPreview in your code, if you modify it, please leave a note, so that readers can follow the discussion.

          Can you show us the code for your slot in Dialog2, please. Also, a stack trace of the crash would be helpful.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • P Offline
            P Offline
            poporacer
            wrote on last edited by
            #7

            I assume that the variable is initialized properly as the dialog2 does open when the emit signal is commented out. The dialog opens without a problem but obviously the data is not sent.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #8

              We know nothing about what is sent or not, as we do not have a stack trace.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on last edited by
                #9

                You have completely changed the code. You are now connecting the signal up to a slot on dialog2 now instead of printPreview.

                Can you please either:

                Provide a complete backtrace as Volker asked or

                upload a tarball of a small compileable example that reproduces the problem

                You will most likely spot the problem yourself in preparing the example.

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  poporacer
                  wrote on last edited by
                  #10

                  How do I get a stack trace? I am not at a computer with a complier. I will provide the info when I find out how and get back to my computer.
                  Here is the code for the slot:
                  dialog2.h
                  @private slots:
                  void createReportTable(QStringList);
                  @
                  dialog2.cpp
                  @void Dialog2::createReportTable(QStringList stringList)
                  {
                  QStringList reportOptions=stringList;
                  printModel= new QSqlRelationalTableModel (this);
                  printModel-> setEditStrategy(QSqlTableModel::OnRowChange);
                  printModel-> setTable (mTableName);
                  printModel-> setRelation (2, QSqlRelation("rider", "id", "LName"));
                  printModel-> setRelation (3, QSqlRelation("track", "id", "TrackName"));
                  printModel-> setRelation (4, QSqlRelation("bike", "id", "BikeName"));

                  //set up printview
                  ui->printView->setModel(printModel);
                  ui->printView->setItemDelegate(new QSqlRelationalDelegate(this));
                  ui->printView->setSelectionMode(QAbstractItemView::SingleSelection);
                  ui->printView->setSelectionBehavior(QAbstractItemView::SelectRows);
                  ui->printView->setColumnHidden(0,true);
                  ui->printView->setColumnHidden(1, true);    
                  ui->printView->setColumnHidden(2, true); 
                  ui->printView->setColumnHidden(3, true); 
                  ui->printView->setColumnHidden(4, true); 
                  

                  if (reportOptions.at(0)=="FSChecked") {
                  printModel->setHeaderData (5, Qt::Horizontal, "Front \n Spring");
                  printModel->setHeaderData (6, Qt::Horizontal, "Spring \n Preload");
                  printModel->setHeaderData (7, Qt::Horizontal, "Oil \n Weight");
                  printModel->setHeaderData (8, Qt::Horizontal, "Oil \n Height");
                  printModel->setHeaderData (9, Qt::Horizontal, "Front \n Compression");
                  printModel->setHeaderData (10, Qt::Horizontal, "Front \n Rebound");
                  printModel->setHeaderData (11, Qt::Horizontal, "Fork \n Tube Height");
                  }

                  else //hide column and place in labels
                  {
                          ui->printView->setColumnHidden(5,true); //Front Spring Rate
                    ui->printView->setColumnHidden(6,true); //Front Spring Preload
                    ui->printView->setColumnHidden(7,true); //Front Oil Weight
                    ui->printView->setColumnHidden(8,true); //Oil Height
                    ui->printView->setColumnHidden(9,true); //Front Compression
                    ui->printView->setColumnHidden(10,true); //Front rebound
                    ui->printView->setColumnHidden(11, true); //Fork Tube Height
                  
                    //Need to place data in lables
                  
                   
                  }
                  

                  if (reportOptions.at(1)== "FTireChecked") //Front tire changes
                  {
                  printModel->setHeaderData (12, Qt::Horizontal, "Tire Type");
                  printModel->setHeaderData (13, Qt::Horizontal, "Tire \n Pressure");
                  printModel->setHeaderData (14, Qt::Horizontal, "Tire \n Modifications");
                  }
                  else
                  {
                  //itemColumn +=;
                  ui->printView->setColumnHidden(12,true);//Tire Type
                  ui->printView->setColumnHidden(13,true);//Tire Pressure
                  ui->printView->setColumnHidden(14,true);//Tire Modifications
                  }

                  printModel->setFilter(mFilterString); //mFilterString is initialized earlier
                  printModel->select();

                  //Set lables and static data

                  }@
                  I will get a small compileable example when I get to my computer.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #11

                    If you run your program in an development environment (Qt Creator, Visual Studio or the like), you will get it almost automatically, once the program crashes.

                    As you do not give us information about your environment, we cannot help you further on this.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      poporacer
                      wrote on last edited by
                      #12

                      I am using QT Creator. I am not getting anything backtrace info. I posted the error messages but I am sure there is more than that in a backtrace. After digging deeper and stepping through the program a million times, I think the problem actually lies in dialog2 when it is creating the table. in particular this line:
                      @printModel->setFilter(mFilterString); //mFilterString is initialized earlier @
                      I am stepping through it...I think I might get it...if not I will keep you posted
                      But if you could give me the info on getting the backtrace, it would be greatly appreciated. Another tool to help me resolve problems.

                      Thanks

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        poporacer
                        wrote on last edited by
                        #13

                        That was the problem! In the string manipulation, there were two single quotes when there should have been a single quote! I would still like the info on getting a backtrace.

                        Thanks again

                        1 Reply Last reply
                        0
                        • Z Offline
                          Z Offline
                          ZapB
                          wrote on last edited by
                          #14

                          When you pause the app in the debugger (either manually or hitting a breakpoint or getting a crash) you should be able to see the call stack in one of the debug panels in qt-creator. From there you can copy it to the clipboard via the context menu.

                          Nokia Certified Qt Specialist
                          Interested in hearing about Qt related work

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            Beka
                            wrote on last edited by
                            #15

                            Hello, i have the same problem, it wrote me:
                            can't find linker symbol for virtual table for QStandardItem' value found qEmptyModel()::cleanup' instead

                            debugger stopped on:
                            @void MyClass::currentChanged ( const QModelIndex & indexCurrent, const QModelIndex & indexPrevious ){
                            QStandardItem *current = comparisonModel->item(indexCurrent.row(), 0);
                            }@

                            i know, im accesing something what didnt exist, because of the message,
                            because I have model set on QTreeView, and indexes have children... but how to acces that item, when i have only index?

                            1 Reply Last reply
                            0
                            • osirisgothraO Offline
                              osirisgothraO Offline
                              osirisgothra
                              wrote on last edited by
                              #16

                              Its not always an issue. When debugging, you need the proper symbols so you can step through code otherwise you will be stepping through assembler language instructions instead (the compiled binary instructions) - There are cases when parts of the API, especially when dealing with core parts that change a lot between versions, are mismatched. In those cases the correct vtable signature matches are not going to happen. And yeah, you will get a message about it if you step into a function that allocates one of such objects, and/or if one or more global static objects are allocated when begin stepping.

                              To resolve this, be sure your linker has access to the libraries with the correct debug symbols. If you often compile software (like in Linux for example) you may have dependencies for other versions mixed in, and possibly symlinked as the "default" library. The compiler just walks through it all hoping to find a match, and when it fails -- thats where you come in (and that message).

                              You can ignore these if they are generated because of symbol lookup during step debugging. If you get them during runtime without debugging, then that's something else altogether. Be advised these messages can happen for more than one root cause. Be sure you keep all your debug and compiler options set in harmony with the version of g++, lib, and other tools that are in use and be mindful of debugging libraries you install - you likely dont need to install -dev versions of libraries unless you want to step into them while debugging or need to statically link with them.

                              All this means is the symbols couldn't be found, your end users will rarely need that, unless your tool is a debugging tool but if it was I would suspect you'd already know all this and more anyway. Just be sure.

                              I'm truly glad you r/offmychess t finally, but please don't go too far, because you r/beyondvoxels and that implies that u r/donewithlife. Oh well time to git back to the lab, because azure sea here, I have a lot of work to do...

                              Christian EhrlicherC 1 Reply Last reply
                              0
                              • osirisgothraO osirisgothra

                                Its not always an issue. When debugging, you need the proper symbols so you can step through code otherwise you will be stepping through assembler language instructions instead (the compiled binary instructions) - There are cases when parts of the API, especially when dealing with core parts that change a lot between versions, are mismatched. In those cases the correct vtable signature matches are not going to happen. And yeah, you will get a message about it if you step into a function that allocates one of such objects, and/or if one or more global static objects are allocated when begin stepping.

                                To resolve this, be sure your linker has access to the libraries with the correct debug symbols. If you often compile software (like in Linux for example) you may have dependencies for other versions mixed in, and possibly symlinked as the "default" library. The compiler just walks through it all hoping to find a match, and when it fails -- thats where you come in (and that message).

                                You can ignore these if they are generated because of symbol lookup during step debugging. If you get them during runtime without debugging, then that's something else altogether. Be advised these messages can happen for more than one root cause. Be sure you keep all your debug and compiler options set in harmony with the version of g++, lib, and other tools that are in use and be mindful of debugging libraries you install - you likely dont need to install -dev versions of libraries unless you want to step into them while debugging or need to statically link with them.

                                All this means is the symbols couldn't be found, your end users will rarely need that, unless your tool is a debugging tool but if it was I would suspect you'd already know all this and more anyway. Just be sure.

                                Christian EhrlicherC Offline
                                Christian EhrlicherC Offline
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on last edited by
                                #17

                                @osirisgothra Can you tell me why you revive such old topics? What's the point of this? Please stop it.

                                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                Visit the Qt Academy at https://academy.qt.io/catalog

                                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