User forums > Help

C::B+QT "undefined reference to vtable"

(1/2) > >>

alfre:
    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

orel:
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 !

MortenMacFly:
It may also be that you mixed object files compiled with- and without the debug switch. Try a re-build.
With regards, Morten.

alfre:
nothing at all., but thanks., and if you have other ideas., write pleace.....
                                                                                                      regards alfre

Mc.Michael:

--- Quote from: alfre on November 02, 2007, 09:39:28 pm ---

#ifndef COUNTER_H_INCLUDED
#define COUNTER_H_INCLUDED

#include <QtGui>   //include todo




--- End quote ---


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
--- End code ---



/* 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]

Navigation

[0] Message Index

[#] Next page

Go to full version