|
this is my "~/.bash_profile":
- # .bash_profile
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
- # User specific environment and startup programs
- TMAKEDIR=/root/2410sQt/tmake-1.13
- TMAKEPATH=$TMAKEDIR/lib/qws/linux-x86-g++
- QT2DIR=/root/2410sQt/qt-2.3.2
- QTEDIR=/root/2410sQt/qt-2.3.10
- LD_LIBRARY_PATH=$QT2DIR/lib:$QTEDIR/lib
- PATH=$PATH:$HOME/bin:/arm2410s/gui/tools/usr/local/arm/3.4.1/bin:$QT2DIR/bin:$QTEDIR/bin:$TMAKEDIR/bin
- BASH_ENV=$HOME/.bashrc
- USERNAME="root"
- export USERNAME BASH_ENV PATH TMAKEDIR TMAKEPATH QT2DIR QTEDIR LD_LIBRARY_PATH
复制代码
下面是编译时的命令行 :
- sh-2.05b# pwd
- /root/exp/designer
- sh-2.05b# ls
- main.cpp test.ui
- sh-2.05b# uic -o test.h test.ui
- sh-2.05b# uic -o test.cpp -i test.h test.ui
- sh-2.05b# progen -t app.t -o test.pro
- sh-2.05b# tmake -o makefile test.pro
- sh-2.05b# ls
- main.cpp makefile test.cpp test.h test.pro test.ui
- sh-2.05b# echo $QTEDIR
- sh-2.05b# export QTDIR=$QTEDIR
- sh-2.05b# echo $QTEDIR
- /root/2410sQt/qt-2.3.10
- sh-2.05b# make
- makefile:120: warning: overriding commands for target `moc_test.cpp'
- makefile:117: warning: ignoring old commands for target `moc_test.cpp'
- g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -DNO_DEBUG -I/root/2410sQt/qt-2.3.10/include -o main.o main.cpp
- g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -DNO_DEBUG -I/root/2410sQt/qt-2.3.10/include -o test.o test.cpp
- /root/2410sQt/qt-2.3.10/bin/moc test.h -o moc_test.cpp
- g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -DNO_DEBUG -I/root/2410sQt/qt-2.3.10/include -o moc_test.o moc_test.cpp
- g++ -o test main.o test.o test.o moc_test.o moc_test.o -L/root/2410sQt/qt-2.3.10/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+0x110): 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+0x110): first defined here
- test.o(.text+0x220): In function `Form1::~Form1 [not-in-charge]()':
- : multiple definition of `Form1::~Form1 [not-in-charge]()'
- test.o(.text+0x220): first defined here
- test.o(.text+0x244): In function `Form1::~Form1 [in-charge]()':
- : multiple definition of `Form1::~Form1 [in-charge]()'
- test.o(.text+0x244): 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+0xcc): In function `Form1::staticMetaObject()':
- : multiple definition of `Form1::staticMetaObject()'
- moc_test.o(.text+0xcc): 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(.data+0x0): multiple definition of `Form1::metaObj'
- moc_test.o(.data+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+0x74): In function `Form1::tr(char const*)':
- : multiple definition of `Form1::tr(char const*)'
- moc_test.o(.text+0x74): first defined here
- moc_test.o(.text+0xa0): In function `Form1::tr(char const*, char const*)':
- : multiple definition of `Form1::tr(char const*, char const*)'
- moc_test.o(.text+0xa0): first defined here
- collect2: ld returned 1 exit status
- make: *** [test] Error 1
- sh-2.05b#
复制代码
用下面的命令编译会成功:
- sh-2.05b# ls
- main.cpp main.o makefile moc_test.cpp moc_test.o test.cpp test.h test.o test.pro test.ui
- sh-2.05b# make clean
- makefile:120: warning: overriding commands for target `moc_test.cpp'
- makefile:117: warning: ignoring old commands for target `moc_test.cpp'
- rm -f main.o test.o test.o moc_test.o moc_test.o moc_test.cpp moc_test.cpp test.cpp test.h test
- rm -f *~ core
- sh-2.05b# ls
- main.cpp makefile test.pro test.ui
- sh-2.05b# rm makefile test.pro
- sh-2.05b# ls
- main.cpp test.ui
- sh-2.05b# export QTDIR=$QT2DIR
- sh-2.05b# uic -o test.h test.ui
- sh-2.05b# uic -o test.cpp -i test.h test.ui
- sh-2.05b# moc -o moc_test.cpp test.h
- sh-2.05b# g++ -I$QTDIR/include test.cpp main.cpp moc_test.cpp -L$QTDIR/lib -lqt
- sh-2.05b# ls
- a.out main.cpp moc_test.cpp test.cpp test.h test.ui
- sh-2.05b# ./a.out
- sh-2.05b#
- Succeed !!!!!!
复制代码
我试了下面的,也不行:
- sh-2.05b# export QTDIR=$QTEDIR
- sh-2.05b# g++ -I$QTDIR/include test.cpp main.cpp moc_test.cpp -L$QTDIR/lib -lqte
- /tmp/ccEv8gGj.o(.gnu.linkonce.d._ZTV5Form1+0x14c): undefined reference to `QWidget::x11Event(_XEvent*)'
- /tmp/ccEv8gGj.o(.gnu.linkonce.d._ZTV5Form1+0x1b4): undefined reference to `QPaintDevice::setX11Data(QPaintDeviceX11Data const*)'
- /tmp/ccEv8gGj.o(.gnu.linkonce.d._ZTI5Form1+0x8): undefined reference to `typeinfo for QDialog'
- collect2: ld returned 1 exit status
- sh-2.05b#
复制代码
:ask
请高手指教,先谢过了,,,小弟新手,帮帮忙................ |
|