LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1548|回复: 4

为什么我用qtdesigner产生的文件,编译不了,??

[复制链接]
发表于 2007-5-20 13:29:15 | 显示全部楼层 |阅读模式
this is my "~/.bash_profile":

  1. # .bash_profile

  2. # Get the aliases and functions
  3. if [ -f ~/.bashrc ]; then
  4.         . ~/.bashrc
  5. fi

  6. # User specific environment and startup programs
  7. TMAKEDIR=/root/2410sQt/tmake-1.13
  8. TMAKEPATH=$TMAKEDIR/lib/qws/linux-x86-g++
  9. QT2DIR=/root/2410sQt/qt-2.3.2
  10. QTEDIR=/root/2410sQt/qt-2.3.10
  11. LD_LIBRARY_PATH=$QT2DIR/lib:$QTEDIR/lib

  12. PATH=$PATH:$HOME/bin:/arm2410s/gui/tools/usr/local/arm/3.4.1/bin:$QT2DIR/bin:$QTEDIR/bin:$TMAKEDIR/bin
  13. BASH_ENV=$HOME/.bashrc
  14. USERNAME="root"

  15. export USERNAME BASH_ENV PATH TMAKEDIR TMAKEPATH QT2DIR QTEDIR LD_LIBRARY_PATH


复制代码


下面是编译时的命令行 :


  1. sh-2.05b# pwd
  2. /root/exp/designer
  3. sh-2.05b# ls
  4. main.cpp  test.ui
  5. sh-2.05b# uic -o test.h test.ui
  6. sh-2.05b# uic -o test.cpp -i test.h test.ui
  7. sh-2.05b# progen -t app.t -o test.pro
  8. sh-2.05b# tmake -o makefile test.pro
  9. sh-2.05b# ls
  10. main.cpp  makefile  test.cpp  test.h  test.pro        test.ui

  11. sh-2.05b# echo $QTEDIR

  12. sh-2.05b# export QTDIR=$QTEDIR
  13. sh-2.05b# echo $QTEDIR
  14. /root/2410sQt/qt-2.3.10
  15. sh-2.05b# make
  16. makefile:120: warning: overriding commands for target `moc_test.cpp'
  17. makefile:117: warning: ignoring old commands for target `moc_test.cpp'
  18. 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
  19. 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
  20. /root/2410sQt/qt-2.3.10/bin/moc test.h -o moc_test.cpp
  21. 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
  22. 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
  23. test.o(.text+0x0): In function `Form1::Form1[not-in-charge](QWidget*, char const*, bool, unsigned)':
  24. : multiple definition of `Form1::Form1[not-in-charge](QWidget*, char const*, bool, unsigned)'
  25. test.o(.text+0x0): first defined here
  26. test.o(.text+0x110): In function `Form1::Form1[in-charge](QWidget*, char const*, bool, unsigned)':
  27. : multiple definition of `Form1::Form1[in-charge](QWidget*, char const*, bool, unsigned)'
  28. test.o(.text+0x110): first defined here
  29. test.o(.text+0x220): In function `Form1::~Form1 [not-in-charge]()':
  30. : multiple definition of `Form1::~Form1 [not-in-charge]()'
  31. test.o(.text+0x220): first defined here
  32. test.o(.text+0x244): In function `Form1::~Form1 [in-charge]()':
  33. : multiple definition of `Form1::~Form1 [in-charge]()'
  34. test.o(.text+0x244): first defined here
  35. test.o(.text+0x268): In function `Form1::~Form1 [in-charge deleting]()':
  36. : multiple definition of `Form1::~Form1 [in-charge deleting]()'
  37. test.o(.text+0x268): first defined here
  38. moc_test.o(.text+0xcc): In function `Form1::staticMetaObject()':
  39. : multiple definition of `Form1::staticMetaObject()'
  40. moc_test.o(.text+0xcc): first defined here
  41. moc_test.o(.text+0x0): In function `Form1::className() const':
  42. : multiple definition of `Form1::className() const'
  43. moc_test.o(.text+0x0): first defined here
  44. moc_test.o(.data+0x0): multiple definition of `Form1::metaObj'
  45. moc_test.o(.data+0x0): first defined here
  46. moc_test.o(.text+0xc): In function `Form1::initMetaObject()':
  47. : multiple definition of `Form1::initMetaObject()'
  48. moc_test.o(.text+0xc): first defined here
  49. moc_test.o(.text+0x74): In function `Form1::tr(char const*)':
  50. : multiple definition of `Form1::tr(char const*)'
  51. moc_test.o(.text+0x74): first defined here
  52. moc_test.o(.text+0xa0): In function `Form1::tr(char const*, char const*)':
  53. : multiple definition of `Form1::tr(char const*, char const*)'
  54. moc_test.o(.text+0xa0): first defined here
  55. collect2: ld returned 1 exit status
  56. make: *** [test] Error 1
  57. sh-2.05b#


复制代码



用下面的命令编译会成功:




  1. sh-2.05b# ls
  2. main.cpp  main.o  makefile  moc_test.cpp  moc_test.o  test.cpp        test.h        test.o        test.pro  test.ui
  3. sh-2.05b# make clean
  4. makefile:120: warning: overriding commands for target `moc_test.cpp'
  5. makefile:117: warning: ignoring old commands for target `moc_test.cpp'
  6. 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
  7. rm -f *~ core
  8. sh-2.05b# ls
  9. main.cpp  makefile  test.pro  test.ui
  10. sh-2.05b# rm makefile test.pro
  11. sh-2.05b# ls
  12. main.cpp  test.ui
  13. sh-2.05b# export QTDIR=$QT2DIR
  14. sh-2.05b# uic -o test.h test.ui
  15. sh-2.05b# uic -o test.cpp -i test.h test.ui
  16. sh-2.05b# moc -o moc_test.cpp test.h
  17. sh-2.05b# g++ -I$QTDIR/include test.cpp main.cpp moc_test.cpp -L$QTDIR/lib -lqt
  18. sh-2.05b# ls
  19. a.out  main.cpp  moc_test.cpp  test.cpp  test.h  test.ui
  20. sh-2.05b# ./a.out
  21. sh-2.05b#

  22. Succeed !!!!!!

复制代码


我试了下面的,也不行:


  1. sh-2.05b# export QTDIR=$QTEDIR
  2. sh-2.05b# g++ -I$QTDIR/include test.cpp main.cpp moc_test.cpp -L$QTDIR/lib -lqte
  3. /tmp/ccEv8gGj.o(.gnu.linkonce.d._ZTV5Form1+0x14c): undefined reference to `QWidget::x11Event(_XEvent*)'
  4. /tmp/ccEv8gGj.o(.gnu.linkonce.d._ZTV5Form1+0x1b4): undefined reference to `QPaintDevice::setX11Data(QPaintDeviceX11Data const*)'
  5. /tmp/ccEv8gGj.o(.gnu.linkonce.d._ZTI5Form1+0x8): undefined reference to `typeinfo for QDialog'
  6. collect2: ld returned 1 exit status
  7. sh-2.05b#



复制代码


:ask
请高手指教,先谢过了,,,小弟新手,帮帮忙................
发表于 2007-5-20 14:06:39 | 显示全部楼层
提示上不是有么,有几个东西没写意,缺库文件吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-20 15:37:22 | 显示全部楼层
小弟愚钝,上面的提示我没看懂,我想问为什么我用同样的步骤(progen->tmake->make)编译QT自带的例子可以通过,用DESIGNER就不可以呢?
看提示好像是MOC 的问题,我只是猜测,的确看不懂,还请兄台详细说来,,,,再谢过
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-20 22:31:28 | 显示全部楼层
自己顶一下,毕业设计用QTE还请各位帮忙呀,,,
回复 支持 反对

使用道具 举报

发表于 2007-5-23 16:34:53 | 显示全部楼层
顶一下,我的问题也差不多,我的./bash_profile没有下面这句话
PATH=$PATHHOME/bin:/arm2410s/gui/tools/usr/local/arm/3.4.1/binQT2DIR/binQTEDIR/binTMAKEDIR

把qte装好后,以前在redhat9自带的qtdesigner上编的程序也make不了了,我也改了路径,把以前./bash_profile里的路径重新输了一边还是不行


我现在想用qte编程,不知是不是可以用qt编好后,编译时作些事就能成为qte程序了,能在framebuffer上运行,谢谢高手指点
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表