• 5392阅读
  • 1回复

qtopia编译问题 [复制链接]

上一主题 下一主题
离线axfwn
 

只看楼主 倒序阅读 楼主  发表于: 2010-04-13
arm-linux-g++ -c -pipe -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/utuLinux2.6.24/qtopia-1.7-tp/qt-embedded-2.3.7/include -o main.o main.cpp
/utuLinux2.6.24/qtopia-1.7-tp/qt-embedded-2.3.7/include/qdialog.h: In copy
   constructor `Form1::Form1(const Form1&)':
/utuLinux2.6.24/qtopia-1.7-tp/qt-embedded-2.3.7/include/qdialog.h:112: 错误: `
   QDialog::QDialog(const QDialog&)' is private
main.cpp:6: 错误: within this context
main.cpp: In function `int main(int, char**)':
main.cpp:6: 错误:   initializing temporary from result of `
   Form1::Form1(QWidget*, const char*, bool, unsigned int)'
make: *** [main.o] 错误 1

以上是make的时候出现的问题,我的main.cpp程序如下:

#include <qapplication.h>
#include "1.h"
int main( int argc, char *argv[] )
{
    QApplication app(argc,argv);
    Form1 f=new Form1();
    f.show();
    return app.exec();
}


1.cpp程序如下:
#include "1.h"

#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/*
*  Constructs a Form1 which is a child of 'parent', with the
*  name 'name' and widget flags set to 'f'
*
*  The dialog will by default be modeless, unless you set 'modal' to
*  TRUE to construct a modal dialog.
*/
Form1::Form1( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
    setName( "aaa" );
    resize( 596, 480 );
    setCaption( tr( "Form1" ) );

    PushButton2 = new QPushButton( this, "PushButton2" );
    PushButton2->setGeometry( QRect( 510, 440, 71, 31 ) );
    PushButton2->setText( tr( "CanCel" ) );

    PushButton1 = new QPushButton( this, "PushButton1" );
    PushButton1->setGeometry( QRect( 420, 440, 71, 31 ) );
    PushButton1->setText( tr( "OK" ) );

    GroupBox1 = new QGroupBox( this, "GroupBox1" );
    GroupBox1->setGeometry( QRect( 120, 80, 280, 170 ) );
    GroupBox1->setTitle( tr( "1" ) );

    QWidget* privateLayoutWidget = new QWidget( GroupBox1, "Layout17" );
    privateLayoutWidget->setGeometry( QRect( 20, 30, 231, 116 ) );
    Layout17 = new QVBoxLayout( privateLayoutWidget );
    Layout17->setSpacing( 6 );
    Layout17->setMargin( 0 );

    Layout15 = new QVBoxLayout;
    Layout15->setSpacing( 6 );
    Layout15->setMargin( 0 );

    Layout13 = new QHBoxLayout;
    Layout13->setSpacing( 6 );
    Layout13->setMargin( 0 );

    TextLabel1 = new QLabel( privateLayoutWidget, "TextLabel1" );
    TextLabel1->setText( tr( "Name:" ) );
    Layout13->addWidget( TextLabel1 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout13->addItem( spacer );

    LineEdit1 = new QLineEdit( privateLayoutWidget, "LineEdit1" );
    Layout13->addWidget( LineEdit1 );
    Layout15->addLayout( Layout13 );

    Layout14 = new QHBoxLayout;
    Layout14->setSpacing( 6 );
    Layout14->setMargin( 0 );

    TextLabel2 = new QLabel( privateLayoutWidget, "TextLabel2" );
    TextLabel2->setText( tr( "Password:" ) );
    Layout14->addWidget( TextLabel2 );

    LineEdit2 = new QLineEdit( privateLayoutWidget, "LineEdit2" );
    Layout14->addWidget( LineEdit2 );
    Layout15->addLayout( Layout14 );
    Layout17->addLayout( Layout15 );

    Layout16 = new QHBoxLayout;
    Layout16->setSpacing( 6 );
    Layout16->setMargin( 0 );

    PushButton7 = new QPushButton( privateLayoutWidget, "PushButton7" );
    PushButton7->setText( tr( "log_in" ) );
    Layout16->addWidget( PushButton7 );
    QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout16->addItem( spacer_2 );

    PushButton8 = new QPushButton( privateLayoutWidget, "PushButton8" );
    PushButton8->setText( tr( "quit" ) );
    Layout16->addWidget( PushButton8 );
    Layout17->addLayout( Layout16 );
}

/*  
*  Destroys the object and frees any allocated resources
*/
Form1::~Form1()
{
    // no need to delete child widgets, Qt does it all for us
}


1.h程序如下:
#ifndef FORM1_H
#define FORM1_H

#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;

class Form1 : public QDialog
{
    Q_OBJECT

public:
    Form1( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
    ~Form1();

    QPushButton* PushButton2;
    QPushButton* PushButton1;
    QGroupBox* GroupBox1;
    QLabel* TextLabel1;
    QLineEdit* LineEdit1;
    QLabel* TextLabel2;
    QLineEdit* LineEdit2;
    QPushButton* PushButton7;
    QPushButton* PushButton8;

protected:
    QVBoxLayout* Layout17;
    QVBoxLayout* Layout15;
    QHBoxLayout* Layout13;
    QHBoxLayout* Layout14;
    QHBoxLayout* Layout16;
};

#endif // FORM1_H


我用的编译器是arm-linux-gcc3.3.2 用的是qt-embedded-2.3.7和qtopia17.0的库文件
离线axfwn

只看该作者 1楼 发表于: 2010-04-14
有谁见过类似的错误呢? 我感觉程序代码好像没问题 环境变量应该也都设置好了 我是刚刚接触这方面的东西 很多不熟悉 麻烦各位大神了
快速回复
限100 字节
 
上一个 下一个