Dr. Norbert Prang
16th June 2006, 13:39
Hello,
is there anybody, who can explain to me the cause for the following strange linker error in my Xcode based Qt project?
/usr/bin/ld: Undefined symbols:
vtable for GoButton
/Users/Norbert/MyCode/SlotTest01/build/SlotTest01.build/Debug/SlotTest01.build/Objects-normal/ppc/main.o reference to undefined vtable for GoButton
collect2: ld returned 1 exit status
/usr/bin/ld: Undefined symbols:
vtable for GoButton
/Users/Norbert/MyCode/SlotTest01/build/SlotTest01.build/Debug/SlotTest01.build/Objects-normal/ppc/main.o reference to undefined vtable for GoButton
collect2: ld returned 1 exit status
For better understanding:
I intended to make just a simple program for testing selfmade slots. The code of the main.cpp ist the following:
#include <qapplication.h>
#include <qpushbutton.h>
#include <qobject.h>
#include <qstring.h>
#include <qwidget.h>
#include <unistd.h>
class GoButton : public QPushButton
{
Q_OBJECT
public:
GoButton(const QString& text, QWidget* parent)
: QPushButton(text, parent)
{
connect(this, SIGNAL(clicked()), this, SLOT(go()));
}
public slots:
void go()
{
static int count = 0;
count++;
if(count > 5)
{
qApp->quit(); //Finish after 5th click
}
}
};
int main(int argc, char** argv)
{
QApplication a(argc, argv);
GoButton* b = new GoButton("Press Me, Please!", 0);
b->show();
QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
return a.exec();
}
I made a Xcode project by processing the main.cpp as the only file in my project directory as follows:
I typed: qmake –project
The resulting Qt .pro file looks as follows:
################################################## ####################
# Automatically generated by qmake (2.00a) Fri Jun 16 13:07:34 2006
################################################## ####################
TEMPLATE = app
TARGET +=
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += main.cpp
Then I typed: qmake
Then I opened the Xcode project and started a build process. All compiler action seemed to be o. k..The linker error above occured.
I cannot explain to me, what could be wrong here.
Can anyone? I hope ...
Have a nice weekend, you all!
Norbert
is there anybody, who can explain to me the cause for the following strange linker error in my Xcode based Qt project?
/usr/bin/ld: Undefined symbols:
vtable for GoButton
/Users/Norbert/MyCode/SlotTest01/build/SlotTest01.build/Debug/SlotTest01.build/Objects-normal/ppc/main.o reference to undefined vtable for GoButton
collect2: ld returned 1 exit status
/usr/bin/ld: Undefined symbols:
vtable for GoButton
/Users/Norbert/MyCode/SlotTest01/build/SlotTest01.build/Debug/SlotTest01.build/Objects-normal/ppc/main.o reference to undefined vtable for GoButton
collect2: ld returned 1 exit status
For better understanding:
I intended to make just a simple program for testing selfmade slots. The code of the main.cpp ist the following:
#include <qapplication.h>
#include <qpushbutton.h>
#include <qobject.h>
#include <qstring.h>
#include <qwidget.h>
#include <unistd.h>
class GoButton : public QPushButton
{
Q_OBJECT
public:
GoButton(const QString& text, QWidget* parent)
: QPushButton(text, parent)
{
connect(this, SIGNAL(clicked()), this, SLOT(go()));
}
public slots:
void go()
{
static int count = 0;
count++;
if(count > 5)
{
qApp->quit(); //Finish after 5th click
}
}
};
int main(int argc, char** argv)
{
QApplication a(argc, argv);
GoButton* b = new GoButton("Press Me, Please!", 0);
b->show();
QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
return a.exec();
}
I made a Xcode project by processing the main.cpp as the only file in my project directory as follows:
I typed: qmake –project
The resulting Qt .pro file looks as follows:
################################################## ####################
# Automatically generated by qmake (2.00a) Fri Jun 16 13:07:34 2006
################################################## ####################
TEMPLATE = app
TARGET +=
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += main.cpp
Then I typed: qmake
Then I opened the Xcode project and started a build process. All compiler action seemed to be o. k..The linker error above occured.
I cannot explain to me, what could be wrong here.
Can anyone? I hope ...
Have a nice weekend, you all!
Norbert