首页| 论坛| 消息

标题:请教Qt2编译一个小程序出现的问题
作者:bluesge
日期:2008-04-08 11:44
内容:

初学QT 遇到一个问题 望大家指点 谢谢!
root@localhost hello]# make
Makefile:119: warning: overriding commands for target `moc_hello.cpp'
Makefile:116: warning: ignoring old commands for target `moc_hello.cpp'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/root/armsys2410/qt/qt/include -I/root/armsys2410/qt/qtopia/include -o main.o main.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/root/armsys2410/qt/qt/include -I/root/armsys2410/qt/qtopia/include -o hello.o hello.cpp
/root/armsys2410/qt/qt/bin/moc hello.h -o moc_hello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/root/armsys2410/qt/qt/include -I/root/armsys2410/qt/qtopia/include -o moc_hello.o moc_hello.cpp
gcc -o hello main.o hello.o hello.o moc_hello.o moc_hello.o -L/root/armsys2410/qt/qt/lib -L/root/armsys2410/qt/qtopia/lib -lm -lqpe -lqtopia -lqte
hello.o(.text+0x0): In function `hello::hello(QWidget*, char const*, unsigned)':
: multiple definition of `hello::hello(QWidget*, char const*, unsigned)'
hello.o(.text+0x0): first defined here
hello.o(.text+0x24c): In function `hello::hello(QWidget*, char const*, unsigned)':
: multiple definition of `hello::hello(QWidget*, char const*, unsigned)'
hello.o(.text+0x24c): first defined here
hello.o(.text+0x498): In function `hello::~hello ()':
: multiple definition of `hello::~hello ()'
hello.o(.text+0x498): first defined here
hello.o(.text+0x4bc): In function `hello::~hello ()':
: multiple definition of `hello::~hello ()'
hello.o(.text+0x4bc): first defined here
hello.o(.text+0x4e0): In function `hello::~hello ()':
: multiple definition of `hello::~hello ()'
hello.o(.text+0x4e0): first defined here
hello.o(.text+0x50c): In function `hello::say_hello()':
: multiple definition of `hello:: ..


#1 [guoyun_he 04-09 09:00]
LD_LIBRARY_PATH 设置正确了吗?
#2 [bluesge 04-09 22:04]
export LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/lib
对吗?
谢谢了!
#3 [浪漫天使 04-10 00:50]
我猜测的 你的pro里面有了
INTERFACES = hello.ui
但是你的
HEADERS 里面又有了 hello.h
或者你的
SOURCES 里面有了 hello.cpp
因为hello.ui生成的文件就是hello.h和 hello.cpp 你又把它放到HEADERS 和 SOURCES里面 就导致了多重定义了
其实 INTERFACES = hello.ui里面就包含了对生成的hello.h和 hello.cpp 处理了 就不要往HEADERS 和 SOURCES加hello.ui生成的东西了,也不要另外创建hello.h和 hello.cpp这样的文件,因为会被生成的覆盖了.......
#4 谢谢了!!!!!!!!!!!!!!!!!!!!!!!!!!! [bluesge 04-12 16:42]
谢谢了!!!!!!!!!!!!!!!!!!!!!!!!!!!

回复 发表
主题 版块