• 6931阅读
  • 5回复

急!急!急!make时不能成功编译,请教各位大虾 [复制链接]

上一主题 下一主题
离线toponeboy
 

只看楼主 正序阅读 楼主  发表于: 2009-02-28
大家好,本人是个初学者,用的是qt-x11-2.3.2,安装的到是没问题.但我自己编了一个简单的GUI,在通过makefile生成能在framebuffer上运行的程序时, make后总是报如下错误.我做实验台附带的实验时都能make成功的(那里源文件和makefile文件他都给好了).由于本人对moc和*.o
还都不太了结,所以恳请各位大虾帮我看看我到底是源程序有问题还是makefile有问题,最好别让我换QT4,目前我还想在这个版本下搞定
#以下是make后屏幕显示#
/usr/lib/qt-3.1/bin/uic Form1.ui -o ./Form1.h
/usr/lib/qt-3.1/bin/uic Form1.ui -i Form1.h -o Form1.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -D
NO_DEBUG -I/usr/lib/qt-3.1/include -o Form1.o Form1.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -D
NO_DEBUG -I/usr/lib/qt-3.1/include -o main.o main.cpp
/usr/lib/qt-3.1/bin/moc Form1.h -o moc_Form1.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -D
NO_DEBUG -I/usr/lib/qt-3.1/include -o moc_Form1.o moc_Form1.cpp
g++  -o Form1 Form1.o main.o Form1.o moc_Form1.o moc_Form1.o  -L/usr/lib/qt-3.1/
lib -lm  -lqte -lstdc++
Form1.o(.text+0x0): In function `Form1::Form1[not-in-charge](QWidget*, char cons
t*, unsigned)':
: multiple definition of `Form1::Form1[not-in-charge](QWidget*, char const*, uns
igned)'
Form1.o(.text+0x0): first defined here
Form1.o(.text+0x374): In function `Form1::languageChange()':
: multiple definition of `Form1::languageChange()'
Form1.o(.text+0x374): first defined here
Form1.o(.text+0x180): In function `Form1::Form1[in-charge](QWidget*, char const*
, unsigned)':
: multiple definition of `Form1::Form1[in-charge](QWidget*, char const*, unsigne
d)'
Form1.o(.text+0x180): first defined here
Form1.o(.text+0x300): In function `Form1::~Form1 [not-in-charge]()':
: multiple definition of `Form1::~Form1 [not-in-charge]()'
Form1.o(.text+0x300): first defined here
Form1.o(.text+0x324): In function `Form1::~Form1 [in-charge]()':
: multiple definition of `Form1::~Form1 [in-charge]()'
Form1.o(.text+0x324): first defined here
Form1.o(.text+0x348): In function `Form1::~Form1 [in-charge deleting]()':
: multiple definition of `Form1::~Form1 [in-charge deleting]()'
Form1.o(.text+0x348): first defined here
moc_Form1.o(.text+0x8c): In function `Form1::staticMetaObject()':
: multiple definition of `Form1::staticMetaObject()'
moc_Form1.o(.text+0x8c): first defined here
moc_Form1.o(.text+0x0): In function `Form1::className() const':
: multiple definition of `Form1::className() const'
moc_Form1.o(.text+0x0): first defined here
moc_Form1.o(.data+0x0): multiple definition of `Form1::metaObj'
moc_Form1.o(.data+0x0): first defined here
moc_Form1.o(.text+0xc): In function `Form1::tr(char const*, char const*)':
: multiple definition of `Form1::tr(char const*, char const*)'
moc_Form1.o(.text+0xc): first defined here
moc_Form1.o(.text+0x4c): In function `Form1::trUtf8(char const*, char const*)':
: multiple definition of `Form1::trUtf8(char const*, char const*)'
moc_Form1.o(.text+0x4c): first defined here
moc_Form1.o(.text+0xe8): In function `Form1::qt_cast(char const*)':
: multiple definition of `Form1::qt_cast(char const*)'
moc_Form1.o(.text+0xe8): first defined here
moc_Form1.o(.text+0x144): In function `Form1::qt_invoke(int, QUObject*)':
: multiple definition of `Form1::qt_invoke(int, QUObject*)'
moc_Form1.o(.text+0x144): first defined here
moc_Form1.o(.text+0x188): In function `Form1::qt_emit(int, QUObject*)':
: multiple definition of `Form1::qt_emit(int, QUObject*)'
moc_Form1.o(.text+0x188): first defined here
moc_Form1.o(.text+0x1a4): In function `Form1::qt_property(int, int, QVariant*)':
: multiple definition of `Form1::qt_property(int, int, QVariant*)'
moc_Form1.o(.text+0x1a4): first defined here
moc_Form1.o(.text+0x1c0): In function `Form1::qt_static_property(QObject*, int,
int, QVariant*)':
: multiple definition of `Form1::qt_static_property(QObject*, int, int, QVariant
*)'
moc_Form1.o(.text+0x1c0): first defined here
/usr/bin/ld: cannot find -lqte
collect2: ld returned 1 exit status
make: *** [Form1] Error 1
离线dragonfever
只看该作者 5楼 发表于: 2011-04-18
回 4楼(dragonfever) 的帖子
呵呵,解决,最后没有楼主的合并.cpp文件的方法
问题的症结在于,在.h文件和.cpp文件中有一项头文件的重复包含声明:
#include <qvariant.h>
我把.cpp中的该声明给注释掉,最后编译通过~

离线dragonfever
只看该作者 4楼 发表于: 2011-04-18
回 2楼(toponeboy) 的帖子
同样问题啊,楼主把所有源代码写进一个.cpp文件,具体怎么做呢?
离线wd007

只看该作者 3楼 发表于: 2009-03-15
我觉得你说的可能的,坛子里面有交叉编译的帖子,可以找
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
离线toponeboy

只看该作者 2楼 发表于: 2009-03-13
这个东西我自己搞定了
我认为问题的根源可能是因为我自己有两套QT,一个是RH9.0附带的QT-3.1,一个是买开发板给的QT/E-2.3.10。在设置环境变量时可能哪个没设,所以moc或者libs哪指定的有问题。。。
我是菜鸟,还往大虾指正,如果有高手看这个帖子的话,呵呵
不过我最后解决的方法是把所有源代码都写到一个cpp文件中,在make的,总之最后成功了,呵呵,还要谢谢楼上回帖的哥们
离线wd007

只看该作者 1楼 发表于: 2009-03-02
看不太清楚,不过你的错误提示里面已经有了一些线索,比如重复定义了什么东东
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
快速回复
限100 字节
 
上一个 下一个