本人想用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重新编辑 ]