TQ2440 x86下的QT编译-----first

平台:TQ2440

X86   QT

按照pdf进行编译,有错误,主要是如下的错误:

Makefile:133: warning: overriding commands for target `moc_first.cpp'
Makefile:130: warning: ignoring old commands for target `moc_first.cpp'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia/qt/include -I/opt/EmbedSky/Qte/x86-qtopia/qtopia/include -o
first.o first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia/qt/include -I/opt/EmbedSky/Qte/x86-qtopia/qtopia/include -o
main.o main.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia/qt/include -I/opt/EmbedSky/Qte/x86-qtopia/qtopia/include -o
moc_first.o moc_first.cpp
g++  -o /opt/EmbedSky/Qte/x86-qtopia/qtopia/bin/first first.o main.o first.o moc_first.o moc_first.o  -L/opt/EmbedSky/Qte/x86-qtopia/qtopia/lib -L/opt/EmbedSky/Qte/x86-qtopia/qt/lib -lqpe -lqtopia -lqte
first.o(.text+0x0): In function `first::first[not-in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `first::first[not-in-charge](QWidget*, char const*, unsigned)'
first.o(.text+0x0): first defined here
first.o(.text+0x344): In function `first::first[in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `first::first[in-charge](QWidget*, char const*, unsigned)'
first.o(.text+0x344): first defined here
first.o(.text+0x688): In function `first::~first [not-in-charge]()':
: multiple definition of `first::~first [not-in-charge]()'
first.o(.text+0x688): first defined here
first.o(.text+0x6ac): In function `first::~first [in-charge]()':
: multiple definition of `first::~first [in-charge]()'
first.o(.text+0x6ac): first defined here
first.o(.text+0x6d0): In function `first::~first [in-charge deleting]()':
: multiple definition of `first::~first [in-charge deleting]()'
first.o(.text+0x6d0): first defined here
first.o(.text+0x6fc): In function `first::event(QEvent*)':
: multiple definition of `first::event(QEvent*)'
first.o(.text+0x6fc): first defined here
first.o(.text+0x778): In function `first::user_button()':
: multiple definition of `first::user_button()'
first.o(.text+0x778): first defined here
moc_first.o(.text+0x0): In function `first::className() const':
: multiple definition of `first::className() const'
moc_first.o(.text+0x0): first defined here
moc_first.o(.data+0x0): multiple definition of `first::metaObj'
moc_first.o(.data+0x0): first defined here
moc_first.o(.text+0xc): In function `first::initMetaObject()':
: multiple definition of `first::initMetaObject()'
moc_first.o(.text+0xc): first defined here
moc_first.o(.text+0xcc): In function `first::staticMetaObject()':
: multiple definition of `first::staticMetaObject()'
moc_first.o(.text+0xcc): first defined here
moc_first.o(.text+0x74): In function `first::tr(char const*)':
: multiple definition of `first::tr(char const*)'
moc_first.o(.text+0x74): first defined here
moc_first.o(.text+0xa0): In function `first::tr(char const*, char const*)':
: multiple definition of `first::tr(char const*, char const*)'
moc_first.o(.text+0xa0): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86-qtopia/qtopia/bin/first] Error 1

解决:原来错误在于Makefile,里面重复编译了同样的文件:

         如:moc_first.o: moc_first.cpp \

                                                 first.h

         竟然编译了两次,重复写了两次。

 

[root@iFico hello]#progen -o first.pro(获取*.pro文件)

然后编辑hello.pro文件,修改为:

TEMPLATE                 =app

CONFIG                    =qtopia warn_on release        (把qt改为qtopia,这样就可以调用qtopia的库)

HEADERS                  =hello.h

SOURCES                  =hello.cpp \

                                    main.cpp

INTERFACES             =                       

一定要将“INTERFACES  = hello.ui”修改为“INTERFACES  =   ”否则会出现错误:报错,重定义。

下面是结果啊:


TQ2440 x86下的QT编译-----first_第1张图片
 
TQ2440 x86下的QT编译-----first_第2张图片
 
TQ2440 x86下的QT编译-----first_第3张图片
 

你可能感兴趣的:(first)