• 9412阅读
  • 8回复

求助 qtdesigner2.3.2的简单移植例子!!!!!! [复制链接]

上一主题 下一主题
离线pen315
 

只看楼主 倒序阅读 楼主  发表于: 2006-05-09
本人想用qtdesigner2.3.2作一简单的例子,移植到开发板,一开始MAKE就有很多问题,痛苦啊,请大侠门帮助啊!!!!!!

具体过程如下:
1.设置环境变量:
export QTDIR=/home/qteqpe/qt-2.3.7
export QPEDIR=/home/qteqpe/qtopia-1.7.0
export LD_LIBRARY_PATH=/home/qteqpe/qt-2.3.2/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/qteqpe/qt-2.3.7/lib:$LD_LIBRARY_PATH
export TMAKEDIR=/home/qteqpe/tamke-1.11
export TMAKEPATH=/home/qteqpe/tmake-1.11/lib/qws/linux-arm-g++
export PATH=/home/qteqpe/tmake-1.11/bin:$PATH
                                                   

2.用qtdesigner2.3.2作了个很简单的.ui文件.什么也没作,就是一个窗口.然后写了一个简单的main.cpp文件:

#include <qapplication.h>
#include "test.h"
                                                   
int main( int argc, char ** argv )
{
  QApplication a( argc, argv );
  Form1 w;
  w.show();
  return a.exec();
}

修改TMAKE的tmake.conf文件
TMAKE_LINK=arm-linux-g++
TMAKE_LINK_SHLIB=arm-linux-g++

3.生成.pro和Makefile文件:
#progen -t app.t -o test.pro
#tmake -o Makefile test.pro

4.make

出现问题
[root@localhost test]# make
/home/qteqpe/qt-2.3.7/bin/uic .ui -o ./.h
fatal parsing error: unexpected end of file in line 1
fatal parsing error: error while parsing prolog in line 1
Parsing error
uic: Failed to parse .ui

make: *** [.h] 已放弃
make: *** Deleting file `.h'

打开test.pro文件
#vi test.pro
TEMPLATE     = app
CONFIG       = qt warn_on release
HEADERS       = .ui/form1.h \
            .ui/test.h
SOURCES       = .ui/test.cpp \
            main.cpp
INTERFACES     = .ui \
            test.ui
~
因为不知道.ui是干嘛在这,所以修改如下:
TEMPLATE     = app
CONFIG       = qt warn_on release
HEADERS       = form1.h \
            test.h
SOURCES       = test.cpp \
            main.cpp
INTERFACES     = test.ui

然后重新生成Makefile,接着make

Makefile:116: warning: overriding commands for target `moc_test.cpp'
Makefile:113: warning: ignoring old commands for target `moc_test.cpp'
/home/qteqpe/qt-2.3.7/bin/uic test.ui -o ./test.h
/home/qteqpe/qt-2.3.7/bin/uic test.ui -i test.h -o test.cpp
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/home/qteqpe/qt-2.3.7/include -o test.o test.cpp
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/home/qteqpe/qt-2.3.7/include -o main.o main.cpp
/home/qteqpe/qt-2.3.7/bin/moc test.h -o moc_test.cpp
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/home/qteqpe/qt-2.3.7/include -o moc_test.o moc_test.cpp
arm-linux-g++ -o test test.o main.o test.o moc_test.o -L/home/qteqpe/qt-2.3.7/lib -lm -lqte
test.o(.text+0x0): In function `Form1::Form1[not-in-charge](QWidget*, char const*, bool, unsigned)':
: multiple definition of `Form1::Form1[not-in-charge](QWidget*, char const*, bool, unsigned)'
test.o(.text+0x0): first defined here
test.o(.text+0x170): In function `Form1::Form1[in-charge](QWidget*, char const*, bool, unsigned)':
: multiple definition of `Form1::Form1[in-charge](QWidget*, char const*, bool, unsigned)'
test.o(.text+0x170): first defined here
test.o(.text+0x2e0): In function `Form1::~Form1 [not-in-charge]()':
: multiple definition of `Form1::~Form1 [not-in-charge]()'
test.o(.text+0x2e0): first defined here
test.o(.text+0x300): In function `Form1::~Form1 [in-charge]()':
: multiple definition of `Form1::~Form1 [in-charge]()'
test.o(.text+0x300): first defined here
test.o(.text+0x320): In function `Form1::~Form1 [in-charge deleting]()':
: multiple definition of `Form1::~Form1 [in-charge deleting]()'
test.o(.text+0x320): first defined here
collect2: ld returned 1 exit status
make: *** [test] Error 1

#vi Makefile   看Compile段,怎么有2个test.o和2个moc_test.cpp???
####### Compile
                                                   
test.o: test.cpp \
          test.h \
          test.ui
                                                   
main.o: main.cpp \
          test.h
                                                   
test.h: test.ui
    $(UIC) test.ui -o $(INTERFACE_DECL_PATH)/test.h
                                                   
test.cpp: test.ui
    $(UIC) test.ui -i test.h -o test.cpp
                                                   
test.o: test.cpp \
          test.h \
          test.ui
                                                   
moc_test.o: moc_test.cpp \
          test.h
                                                   
moc_test.cpp: test.h
    $(MOC) test.h -o moc_test.cpp
                                                   
moc_test.cpp: test.h
    $(MOC) test.h -o moc_test.cpp
                                                   
然后就不知道该怎么办了啊??

帮忙啊!!!!!!!!
[ 此贴被XChinux在2006-05-09 19:11重新编辑 ]
离线pen315

只看该作者 1楼 发表于: 2006-05-09
在上面的基础上,把Makefile中重复的去掉,make.还是同样的 问题!!!!!!!!
离线pen315

只看该作者 2楼 发表于: 2006-05-09
arm-linux-g++ -o test test.o main.o test.o moc_test.o -L/home/qteqpe/qt-2.3.7/lib -lm -lqte
test.o(.text+0x0): In function `Form1::Form1[not-in-charge](QWidget*, char const*, bool, unsigned)':
: multiple definition of `Form1::Form1[not-in-charge](QWidget*, char const*, bool, unsigned)'
test.o(.text+0x0): first defined here
test.o(.text+0x170): In function `Form1::Form1[in-charge](QWidget*, char const*, bool, unsigned)':
: multiple definition of `Form1::Form1[in-charge](QWidget*, char const*, bool, unsigned)'
test.o(.text+0x170): first defined here
test.o(.text+0x2e0): In function `Form1::~Form1 [not-in-charge]()':
: multiple definition of `Form1::~Form1 [not-in-charge]()'
test.o(.text+0x2e0): first defined here
test.o(.text+0x300): In function `Form1::~Form1 [in-charge]()':
: multiple definition of `Form1::~Form1 [in-charge]()'
test.o(.text+0x300): first defined here
test.o(.text+0x320): In function `Form1::~Form1 [in-charge deleting]()':
: multiple definition of `Form1::~Form1 [in-charge deleting]()'
test.o(.text+0x320): first defined here
collect2: ld returned 1 exit status
make: *** [test] Error 1
离线pen315

只看该作者 3楼 发表于: 2006-05-10
为什么就是没有人回复呢?是不是问题太简单了啊!!!


昨天晚上,后来终于搞定,可以移植,在板子上正常显示。这里写下供大家参考,不过其中还是有很多地方不太明白,希望大家能够指点下,谢谢了!
过程如下:
1.因为按原来的步骤下来,在Makefile中,还是会生成.h和.cpp文件。所以我在开始,先由.ui文 件 生成.h和.cpp文件,再把.ui文件删除。
2.接着生成.pro文件,在这里,有点不明白,因为生成的.pro文件里面,就象我上面的贴一样,有.ui这个文件夹(后来查看,这里有好几个隐藏文件夹.ui   .moc等)。不知道这些是怎么生成的,不过也就知道了progen命令搜索的文件,当然就把.ui .moc文件夹里面的.h .cpp文件给找出来了!我把.ui下面搜索的文件全部去掉,下面生成的Makefile 就正常了!!可以正常
make.



上面不明白为什么会生成隐藏文件夹.ui .moc里面都是些.h和.cpp文件???
离线arthurcao

只看该作者 4楼 发表于: 2006-06-10
引用第3楼pen3152006-05-10 10:33发表的“”:
为什么就是没有人回复呢?是不是问题太简单了啊!!! [表情]
昨天晚上,后来终于搞定,可以移植,在板子上正常显示。这里写下供大家参考,不过其中还是有很多地方不太明白,希望大家能够指点下,谢谢了!
过程如下:
.......


想知道,我和你的问题一样
离线gbtux

只看该作者 5楼 发表于: 2006-06-12
楼主,您说的方法我不太明白.
"这里有好几个隐藏文件夹. ui   .moc等"指的是哪里?test.ui所在的文件夹中并没有别的文件阿.
另外,按照您说的方法,我现在生成Makefile文件正常,但是报错信息还是依旧,怎么回事?
有别人知道吗?谢谢了.

我的错误信息:

Makefile:119: 警告:覆盖关于目标“moc_test.cpp”的命令
Makefile:116: 警告:忽略关于目标“moc_test.cpp”的旧命令
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/usr/local/arm-linux/qt_toolchain/qt-2.3.7/include -o main.o main.cpp
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/usr/local/arm-linux/qt_toolchain/qt-2.3.7/include -o test.o test.cpp
/usr/local/arm-linux/qt_toolchain/qt-2.3.7/bin/moc test.h -o moc_test.cpp
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/usr/local/arm-linux/qt_toolchain/qt-2.3.7/include -o moc_test.o moc_test.cpp
arm-linux-g++ -o test main.o test.o test.o moc_test.o moc_test.o -L/usr/local/arm-linux/qt_toolchain/qt-2.3.7/lib -lm -lqte -lts
test.o(.text+0x0): In function `Form1::Form1[not-in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `Form1::Form1[not-in-charge](QWidget*, char const*, unsigned)'
test.o(.text+0x0): first defined here
test.o(.text+0x294): In function `Form1::languageChange()':
: multiple definition of `Form1::languageChange()'
test.o(.text+0x294): first defined here
test.o(.text+0x114): In function `Form1::Form1[in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `Form1::Form1[in-charge](QWidget*, char const*, unsigned)'
test.o(.text+0x114): first defined here
test.o(.text+0x228): In function `Form1::~Form1 [not-in-charge]()':
: multiple definition of `Form1::~Form1 [not-in-charge]()'
test.o(.text+0x228): first defined here
test.o(.text+0x248): In function `Form1::~Form1 [in-charge]()':
: multiple definition of `Form1::~Form1 [in-charge]()'
test.o(.text+0x248): first defined here
test.o(.text+0x268): In function `Form1::~Form1 [in-charge deleting]()':
: multiple definition of `Form1::~Form1 [in-charge deleting]()'
test.o(.text+0x268): first defined here
moc_test.o(.text+0x0): In function `Form1::className() const':
: multiple definition of `Form1::className() const'
moc_test.o(.text+0x0): first defined here
moc_test.o(.bss+0x0): multiple definition of `Form1::metaObj'
moc_test.o(.bss+0x0): first defined here
moc_test.o(.text+0xc): In function `Form1::initMetaObject()':
: multiple definition of `Form1::initMetaObject()'
moc_test.o(.text+0xc): first defined here
moc_test.o(.text+0xe8): In function `Form1::staticMetaObject()':
: multiple definition of `Form1::staticMetaObject()'
moc_test.o(.text+0xe8): first defined here
moc_test.o(.text+0x70): In function `Form1::tr(char const*)':
: multiple definition of `Form1::tr(char const*)'
moc_test.o(.text+0x70): first defined here
moc_test.o(.text+0xac): In function `Form1::tr(char const*, char const*)':
: multiple definition of `Form1::tr(char const*, char const*)'
moc_test.o(.text+0xac): first defined here
collect2: ld returned 1 exit status
make: *** [test] 错误 1
离线pen315

只看该作者 6楼 发表于: 2006-06-27
我上面所说的"几个隐藏文件夹. ui   .moc等",后来想可能是在经过我N次的make 后产生的几个隐藏文件夹,清除完全后,再重新开始就没有了!
  你的问题,
  1 .可以看下你的pro文件,看看里面的包含的一些文件,是不是都是自己认识的!
  2.看下头文件是不是正常,因为报错都是一些类里面的定义的.

研究不多,供参考.
离线sailor
只看该作者 7楼 发表于: 2009-03-25
我也出现上面的现在,上面的操作,并没有通过,还是一样的现在。
why?
离线dhajmd
只看该作者 8楼 发表于: 2009-07-14
您只要把xxxx.pro這個檔裡有一個INTERFACES = XXXX.ui 修改成 INTERFACES =  (不加任何東西,空白),再重新tmake就可以了
原因是因為這行會讓Makefile某些東西重複變成二個,去掉後產生的Makefile只有一個
快速回复
限100 字节
 
上一个 下一个