nupul
5th May 2006, 08:41
This is the error I got after running the following commands:
qmake -project
qmake
make
moc_desktop.o: In function `MyDesktop:: progs_Clicked()':
/home/nupul/trials/2desktop/moc_desktop.cpp:93: multiple definition of
`MyDesktop:: progs_Clicked()'
desktop.o:/home/nupul/trials/2desktop/desktop.cpp:94: first defined here
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop:: progs_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
moc_desktop.o: In function `MyDesktop:: docs_Clicked()':
/home/nupul/trials/2desktop/moc_desktop.cpp:87: multiple definition of
`MyDesktop:: docs_Clicked()'
desktop.o:/home/nupul/trials/2desktop/desktop.cpp:87: first defined here
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop:: docs_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
moc_desktop.o: In function `MyDesktop::mycomp_Clicked()':
/home/nupul/trials/2desktop/moc_desktop.cpp:81: multiple definition of `MyDesktop::mycomp_Clicked()'
desktop.o:/home/nupul/trials/2desktop/desktop.cpp:80: first defined here
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop::mycomp_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
collect2: ld returned 1 exit status
make: *** [2desktop] Error 1
here is my header file format...
class MyDesktop : public QWidget
{
Q_OBJECT
private:
QPushButton *mycomp;
QPushButton *docs;
QPushButton *progs;
QPushButton *trash;
QBrush brush;
QPalette pal;
void getBackground();
void createButtons();
public:
MyDesktop();
signals:
void showMyComputerMenu();
protected:
void resizeEvent(QResizeEvent *event);
};
#endif
This is my constructor
MyDesktop::MyDesktop():QWidget(0)
{
setGeometry(100,100,400,400);
setWindowTitle("My Desktop");
getBackground();
createButtons();
connect(mycomp,SIGNAL(clicked()),this,SLOT(showMyC omputerMenu()));
}
and this is the signal
void MyDesktop::showMyComputerMenu()
{
qDebug("My computer signal activate");
}
Now the thing is this...if i change my signal: showMyComputerMenu to a slot, and run the aforementioned command sequence,
it works fine! No errors pop-up. I read through the docs, and it said qmake can take care of all the signals/slots etc. I have a feeling that I am missing out something...like running moc, But I am not able to understand at all what am I exactly supposed to do???
:confused:
Thanks
Nupul.
qmake -project
qmake
make
moc_desktop.o: In function `MyDesktop:: progs_Clicked()':
/home/nupul/trials/2desktop/moc_desktop.cpp:93: multiple definition of
`MyDesktop:: progs_Clicked()'
desktop.o:/home/nupul/trials/2desktop/desktop.cpp:94: first defined here
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop:: progs_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
moc_desktop.o: In function `MyDesktop:: docs_Clicked()':
/home/nupul/trials/2desktop/moc_desktop.cpp:87: multiple definition of
`MyDesktop:: docs_Clicked()'
desktop.o:/home/nupul/trials/2desktop/desktop.cpp:87: first defined here
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop:: docs_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
moc_desktop.o: In function `MyDesktop::mycomp_Clicked()':
/home/nupul/trials/2desktop/moc_desktop.cpp:81: multiple definition of `MyDesktop::mycomp_Clicked()'
desktop.o:/home/nupul/trials/2desktop/desktop.cpp:80: first defined here
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `MyDesktop::mycomp_Clicked()' changed from 24 in desktop.o to 29 in moc_desktop.o
collect2: ld returned 1 exit status
make: *** [2desktop] Error 1
here is my header file format...
class MyDesktop : public QWidget
{
Q_OBJECT
private:
QPushButton *mycomp;
QPushButton *docs;
QPushButton *progs;
QPushButton *trash;
QBrush brush;
QPalette pal;
void getBackground();
void createButtons();
public:
MyDesktop();
signals:
void showMyComputerMenu();
protected:
void resizeEvent(QResizeEvent *event);
};
#endif
This is my constructor
MyDesktop::MyDesktop():QWidget(0)
{
setGeometry(100,100,400,400);
setWindowTitle("My Desktop");
getBackground();
createButtons();
connect(mycomp,SIGNAL(clicked()),this,SLOT(showMyC omputerMenu()));
}
and this is the signal
void MyDesktop::showMyComputerMenu()
{
qDebug("My computer signal activate");
}
Now the thing is this...if i change my signal: showMyComputerMenu to a slot, and run the aforementioned command sequence,
it works fine! No errors pop-up. I read through the docs, and it said qmake can take care of all the signals/slots etc. I have a feeling that I am missing out something...like running moc, But I am not able to understand at all what am I exactly supposed to do???
:confused:
Thanks
Nupul.