Author Topic: C::B+QT "undefined reference to vtable"  (Read 7412 times)

alfre

  • Guest
C::B+QT "undefined reference to vtable"
« on: November 02, 2007, 09:39:28 pm »
    I'm sorry my english, I speak spanish.

     I use C::B + Qt on Linux,
     when I try to do my own public slots method I got an Error :  "undefined reference to vtable"  WHY???

                                                               THANKS FOR YOU HELP!!!!!!
HERE the code:

#ifndef COUNTER_H_INCLUDED
#define COUNTER_H_INCLUDED

#include <QtGui>   //include todo

class Counter : public QWidget
 {
    Q_OBJECT

 private:
     QPushButton * but1;
     QPushButton * but2;

 public :
     Counter() : QWidget()
   {
          
         but1 = new QPushButton("the 1", this);
         but1->setGeometry(10,50,100,50);
        
         but2 = new QPushButton("the 2", this);
    but2->setGeometry(200,50,100,50);

   QObject::connect(but1, SIGNAL(clicked()), this, SLOT(Esconder2()));
      }

public slots:
       void Esconder2(){ but2->hide(); }

 };

#endif // COUNTER_H_INCLUDED

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: C::B+QT "undefined reference to vtable"
« Reply #1 on: November 03, 2007, 04:21:55 pm »
This can arrive when you didn't declare and implement a destructor (virtual or not) and you defined your own contructor. I am not at home to test that with your code but, hope it helps !
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: C::B+QT "undefined reference to vtable"
« Reply #2 on: November 05, 2007, 09:47:09 am »
It may also be that you mixed object files compiled with- and without the debug switch. Try a re-build.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

alfre

  • Guest
Re: C::B+QT "undefined reference to vtable"
« Reply #3 on: November 05, 2007, 04:53:40 pm »
nothing at all., but thanks., and if you have other ideas., write pleace.....
                                                                                                      regards alfre

Offline Mc.Michael

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: C::B+QT "undefined reference to vtable"
« Reply #4 on: November 05, 2007, 08:10:05 pm »


#ifndef COUNTER_H_INCLUDED
#define COUNTER_H_INCLUDED

#include <QtGui>   //include todo





try
#ifndef COUNTER_H_INCLUDED
#define COUNTER_H_INCLUDED

#include <QtGui/QWidget>
#include <QtGui/QPushButton>

or
#ifndef COUNTER_H_INCLUDED
#define COUNTER_H_INCLUDED

#include <QWidget>
#include <QPushButton>

if you use your own slots, read info about MOC utility and add to Pre-Build step moc-info file generation

my bachelor project : mingw gcc 3.4.5 & Qt 4.3.1 with CB project files on win2k3
Code
http://www.download.mware.ru/mwOCR.v.0.0.1.24.7z



/* I'm sorry my english, I speak ukranian and russian.*/

in attached test.7z your code. work on win2k3sp2 & qt 4.3.2 & vista platform sdk

[attachment deleted by admin]
« Last Edit: November 05, 2007, 08:40:07 pm by Mc.Michael »

alfre

  • Guest
Re: C::B+QT "undefined reference to vtable"
« Reply #5 on: November 06, 2007, 10:13:56 pm »
nothing again :(

   Mc.Michael, if you have done your own method slots, please sent to me the code, to try with it. thanks you

alfre

  • Guest
Re: C::B+QT "undefined reference to vtable"
« Reply #6 on: November 08, 2007, 09:26:50 pm »
 :D :D :D Its work .I put in the console  dir make clean and all ok.... Thanks for your time