主题 : 求救!!Qtopia的第一个程序老是编译不过!! 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 15010
精华: 0
发帖: 33
金钱: 170 两
威望: 34 点
贡献值: 0 点
综合积分: 66 分
注册时间: 2010-02-26
最后登录: 2012-10-25
楼主  发表于: 2010-08-03 22:52

 求救!!Qtopia的第一个程序老是编译不过!!

我弄这个mini2440的Qtopia应用编程弄了好几天了,连第一个程序都编译不过,真的好郁闷!!照着http://www.aiothome.net/read.php?tid-5599-keyword-%D4%B4%C2%EB.html这个帖子做都编译不过!我把错误信息贴出来,大家帮忙看看哈
[root@localhost myhello]# ./build
Makefile:187: 警告:覆盖关于目标“.moc/release-shared/moc_myhello.cpp”的命令
Makefile:184: 警告:忽略关于目标“.moc/release-shared/moc_myhello.cpp”的旧命令
rm -f .obj/release-shared/moc_myhello.o .obj/release-shared/moc_testHello.o
rm -f .moc/release-shared/moc_myhello.cpp .moc/release-shared/moc_testHello.cpp
rm -f .ui/release-shared/testHello.cpp .ui/release-shared/testHello.h
rm -f .obj/release-shared/myhello.o .obj/release-shared/main.o .obj/release-shared/testHello.o
rm -f *~ core *.core
Makefile:187: 警告:覆盖关于目标“.moc/release-shared/moc_myhello.cpp”的命令
Makefile:184: 警告:忽略关于目标“.moc/release-shared/moc_myhello.cpp”的旧命令
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/uic testHello.ui -o .ui/release-shared/testHello.h
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"myhello\" -DQTOPIA_TRTARGET=\"myhello\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I. -I.moc/release-shared/ -o .obj/release-shared/myhello.o myhello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"myhello\" -DQTOPIA_TRTARGET=\"myhello\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I. -I.moc/release-shared/ -o .obj/release-shared/main.o main.cpp
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/uic testHello.ui -i testHello.h -o .ui/release-shared/testHello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"myhello\" -DQTOPIA_TRTARGET=\"myhello\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I. -I.moc/release-shared/ -o .obj/release-shared/testHello.o .ui/release-shared/testHello.cpp
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/moc myhello.h -o .moc/release-shared/moc_myhello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"myhello\" -DQTOPIA_TRTARGET=\"myhello\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I. -I.moc/release-shared/ -o .obj/release-shared/moc_myhello.o .moc/release-shared/moc_myhello.cpp
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/moc .ui/release-shared/testHello.h -o .moc/release-shared/moc_testHello.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"myhello\" -DQTOPIA_TRTARGET=\"myhello\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I. -I.moc/release-shared/ -o .obj/release-shared/moc_testHello.o .moc/release-shared/moc_testHello.cpp
g++ -o myhello .obj/release-shared/myhello.o .obj/release-shared/main.o .obj/release-shared/testHello.o .obj/release-shared/moc_myhello.o .obj/release-shared/moc_testHello.o -lqtopia2 -lqtopia -lqpe -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/lib -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/lib -lqte
.obj/release-shared/testHello.o: In function `non-virtual thunk to MyHelloForm::~MyHelloForm()':
testHello.cpp:(.text+0x0): multiple definition of `non-virtual thunk to MyHelloForm::~MyHelloForm()'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x0): first defined here
.obj/release-shared/testHello.o: In function `MyHelloForm::~MyHelloForm()':
testHello.cpp:(.text+0x8): multiple definition of `MyHelloForm::~MyHelloForm()'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x8): first defined here
.obj/release-shared/testHello.o: In function `non-virtual thunk to MyHelloForm::~MyHelloForm()':
testHello.cpp:(.text+0x34): multiple definition of `non-virtual thunk to MyHelloForm::~MyHelloForm()'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x34): first defined here
.obj/release-shared/testHello.o: In function `MyHelloForm::~MyHelloForm()':
testHello.cpp:(.text+0x3c): multiple definition of `MyHelloForm::~MyHelloForm()'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x3c): first defined here
.obj/release-shared/testHello.o: In function `MyHelloForm::~MyHelloForm()':
testHello.cpp:(.text+0x56): multiple definition of `MyHelloForm::~MyHelloForm()'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x56): first defined here
.obj/release-shared/testHello.o: In function `MyHelloForm::MyHelloForm(QWidget*, char const*, unsigned int)':
testHello.cpp:(.text+0x70): multiple definition of `MyHelloForm::MyHelloForm(QWidget*, char const*, unsigned int)'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x70): first defined here
.obj/release-shared/testHello.o: In function `MyHelloForm::MyHelloForm(QWidget*, char const*, unsigned int)':
testHello.cpp:(.text+0x172): multiple definition of `MyHelloForm::MyHelloForm(QWidget*, char const*, unsigned int)'
.obj/release-shared/myhello.o:myhello.cpp:(.text+0x172): first defined here
.obj/release-shared/moc_testHello.o: In function `MyHelloForm::className() const':
moc_testHello.cpp:(.text+0x0): multiple definition of `MyHelloForm::className() const'
.obj/release-shared/moc_myhello.o:moc_myhello.cpp:(.text+0x0): first defined here
.obj/release-shared/moc_testHello.o: In function `MyHelloForm::staticMetaObject()':
moc_testHello.cpp:(.text+0x52): multiple definition of `MyHelloForm::staticMetaObject()'
.obj/release-shared/moc_myhello.o:moc_myhello.cpp:(.text+0x52): first defined here
.obj/release-shared/moc_testHello.o:(.bss+0x0): multiple definition of `MyHelloForm::metaObj'
.obj/release-shared/moc_myhello.o:(.bss+0x0): first defined here
.obj/release-shared/moc_testHello.o: In function `MyHelloForm::tr(char const*, char const*)':
moc_testHello.cpp:(.text+0x9c): multiple definition of `MyHelloForm::tr(char const*, char const*)'
.obj/release-shared/moc_myhello.o:moc_myhello.cpp:(.text+0x9c): first defined here
.obj/release-shared/moc_testHello.o: In function `MyHelloForm::tr(char const*)':
moc_testHello.cpp:(.text+0xc6): multiple definition of `MyHelloForm::tr(char const*)'
.obj/release-shared/moc_myhello.o:moc_myhello.cpp:(.text+0xc6): first defined here
.obj/release-shared/moc_testHello.o: In function `MyHelloForm::initMetaObject()':
moc_testHello.cpp:(.text+0xf0): multiple definition of `MyHelloForm::initMetaObject()'
.obj/release-shared/moc_myhello.o:moc_myhello.cpp:(.text+0xf0): first defined here
collect2: ld returned 1 exit status
make: *** [myhello] 错误 1
下面是myhello.pro文件
######################################################################
# Automatically generated by qmake (1.07a) Tue Aug 3 22:34:42 2010
######################################################################
CONFIG      += qtopiaapp
CONFIG      -= buildQuicklaunch
HEADERS     = myhello.h
SOURCES     = myhello.cpp
TEMPLATE = app
INCLUDEPATH += .
# Input
HEADERS += myhello.h
INTERFACES += testHello.ui
SOURCES += main.cpp
TARGET      = myhello
下面是main.cpp文件
#include "myhello.h"
#include <qtopia/qpeapplication.h>
QTOPIA_ADD_APPLICATION("myhello",MyHelloForm)
QTOPIA_MAIN
下面是myhello.h文件
#ifndef MYHELLOFORM_H
#define MYHELLOFORM_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QPushButton;
class MyHelloForm : public QWidget
{
    Q_OBJECT
public:
    MyHelloForm( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~MyHelloForm();
    QPushButton* PushButton;
};
#endif // MYHELLOFORM_H


下面是myhello.cpp文件
#include "myhello.h"
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
 *  Constructs a MyHelloForm which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 */
MyHelloForm::MyHelloForm( QWidget* parent,  const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
    setName( "MyHelloForm" );
    resize( 259, 317 );
    setCaption( tr( "Say Hi to ..Qtopia" ) );
    PushButton = new QPushButton( this, "PushButton" );
    PushButton->setGeometry( QRect( 70, 140, 111, 51 ) );
    PushButton->setText( tr( "PushButtonOK" ) );
}

级别: 新手上路
UID: 15010
精华: 0
发帖: 33
金钱: 170 两
威望: 34 点
贡献值: 0 点
综合积分: 66 分
注册时间: 2010-02-26
最后登录: 2012-10-25
1楼  发表于: 2010-08-04 08:57
终于搞定!!由于没有好好理解eddylau的话,所以导致错误了!
级别: 新手上路
UID: 33077
精华: 0
发帖: 13
金钱: 65 两
威望: 13 点
贡献值: 0 点
综合积分: 26 分
注册时间: 2010-11-25
最后登录: 2011-01-28
2楼  发表于: 2010-11-26 15:00
   也不说说怎么解决的啊,我也遇到了相同的问题,一直搞不出,求救 !!!!!!!!!!!!!!!!!!!!!!
级别: 新手上路
UID: 34537
精华: 0
发帖: 3
金钱: 15 两
威望: 3 点
贡献值: 0 点
综合积分: 6 分
注册时间: 2010-12-17
最后登录: 2011-03-08
3楼  发表于: 2010-12-17 12:54
请问怎么搞定的,我也遇到同样的问题,指点一下