`

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  =   ”否则会出现错误:报错,重定义。

下面是结果啊:



 

 

 

  • 大小: 95.4 KB
  • 大小: 83.5 KB
  • 大小: 173.5 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics