News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

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

Started by alfre, November 02, 2007, 09:39:28 PM

Previous topic - Next topic

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 !
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :[url="http://forums.next.codeblocks.org/index.php/topic,7063.0.html"]http://forums.next.codeblocks.org/index.php/topic,7063.0.html[/url]

MortenMacFly

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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

alfre

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

Mc.Michael

#4
Quote from: alfre on November 02, 2007, 09:39:28 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
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]

alfre

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

 :D :D :D Its work .I put in the console  dir make clean and all ok.... Thanks for your time