QT program linking problems

The Reverant reverant at freemail.gr
Thu May 24 13:17:01 EEST 2001


Paides xaireto
Ftiaxno ena dokimastiko programma pou xrisimopoiei QT, kai otan pao na to 
kano compile kia meta link perno to akoloutho error:

test2.o: In function `QShared::deref(void)':
/usr/lib/qt2/include/qstring.h(.text+0x1d): undefined reference to 
`TempReader virtual table'
test2.o: In function `TempReader::~TempReader(void)':
/home/reverant/test/test/test2.cpp:23: undefined reference to `TempReader 
virtual table'
collect2: ld returned 1 exit status

Kserei kaneis ti paizei kai "xtipaei"?
To kano make mesa apo to kdevelop, to programma exei ksekinisei na ftiaxnetai 
os "QT 2.2 SDI program" mesa apo ton wizard tou kdevelop (1.4).

To programma einai to eksis:

#include <qapplication.h>
#include <qpushbutton.h>
#include <iostream>

class TempReader : public QObject
{
Q_OBJECT
public:
QPushButton * aButton;
TempReader();
~TempReader();
public slots:
void readTemp();
};

TempReader::TempReader()
{
aButton=new QPushButton("Push to read", 0);
QObject::connect(aButton, SIGNAL( clicked() ), this, SLOT ( readTemp() ));
}

TempReader::~TempReader()
{ delete aButton; }

void TempReader::readTemp()
{ cout << "Does something...\n"; }

int main( int argc, char **argv )
{
QApplication a( argc, argv );
TempReader readCPU0;

a.setMainWidget(readCPU0.aButton);
readCPU0.aButton->show();
return a.exec();
}

--
The Reverant
(Dimitris Stasinopoulos)

"Eimaste Mafiozoi.
 Mas xtipate, sas xtipame.
 Einai i douleia mas."



More information about the Linux-greek-users mailing list