到Qt教材的第二章我都成功编译好了开发环境,到第三章我按照教材,成功生成了所有所需要的文件,按照教材,把Makefile文件里面按照教材修改好了,也把重复的地方删除了。其他文件也都按教材修改好了。
然后我在输入命令make后,系统编译了一会,最后显示ld returned 1 exit status。编译信息如下:
[root@localhost First]# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o first.o first.cpp
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include/qtooltip.h:87: warning: ‘class QToolTip’ has virtual functions but non-virtual destructor
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o main.o main.cpp
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include/qdatetime.h:51: warning: ‘class QDate’ has virtual functions but non-virtual destructor
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qcom.h:88: warning: ‘struct QUnknownInterface’ has virtual functions but non-virtual destructor
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qcom.h:100: warning: ‘struct QLibraryInterface’ has virtual functions but non-virtual destructor
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/applicationinterface.h:49: warning: ‘struct ApplicationInterface’ has virtual functions but non-virtual destructor
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o moc_first.o moc_first.cpp
g++ -o /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first first.o main.o first.o moc_first.o -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -lqpe -lqtopia -lqte
first.o: In function `first::~first()':
first.cpp:(.text+0x0): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x0): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x30): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x30): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x50): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x50): first defined here
first.o: In function `first::user_button()':
first.cpp:(.text+0x70): multiple definition of `first::user_button()'
first.o:first.cpp:(.text+0x70): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0xf0): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0xf0): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x420): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x420): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first] Error 1 |