天嵌 ARM开发社区

 找回密码
 注册
查看: 2234|回复: 4

first的编译出现问题

[复制链接]
xiaofuhaixia 发表于 2009-9-1 17:24:18 | 显示全部楼层 |阅读模式
本帖最后由 xiaofuhaixia 于 2009-9-1 17:29 编辑

我的first.cpp的内容ruxia

#include "first.h"

#include <qvariant.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

/*
*  Constructs a first as a child of 'parent', with the
*  name 'name' and widget flags set to 'f'.
*/

first::first( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{  
    QPixmap image0( ( const char** )image0_data );
    if ( !name )
        setName( "first" );
        resize(451,305);
        setCaption( tr("EmbedSky_First_Qt_Program") );

    user_b = new QPushButton( this, "user_b" );
    user_b->setGeometry( QRect( 60, 20, 100, 30 ) );
    user_b->setText( tr("User Button") );

    close = new QPushButton( this, "close" );
    close->setGeometry( QRect( 120, 140, 80, 28 ) );
    close->setText( tr("Close") );

    user_t = new QLabel( this, "user_t" );
    user_t->setGeometry( QRect( 20, 70, 188, 30 ) );
    QFont user_t_font(  user_t->font() );
    user_t_font.setPointSize( 18 );
    user_t_font.setBold( TRUE );
    user_t->setFont( user_t_font );
    user_t->setText( tr("") );
  

    PixmapLabel1= new QLabel(this,"PixmapLabel1");
    PixmapLabel1->setGeometry( QRect( 260, 20, 28, 98 ) );
    PixmapLabel1->setPixmap( image0 );
    PixmapLabel1->setScaledContents( TRUE );

    // signals and slots connections
    connect( user_b, SIGNAL( clicked() ), this, SLOT( user_button() ) );
    connect( close, SIGNAL( clicked() ), this, SLOT( close() ) );
}

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

/*
*  Sets the strings of the subwidgets using the current
*  language.
*/

bool first::event(QEvent*ev)
{    bool ret = QWidget::event(ev);
    if (ev->type()==QEvent::ApplicationFontChange)
  { QFont user_t_font(user_t->font());
   user_t_font.setPointSize( 18 );
   user_t_font.setBold( TRUE );
   user_t->setFont( user_t_font );
}
  return ret;
}


void first::user_button()
{     user_t->setText( tr("Hello,Qt Application !") );
    //qWarning( "first::user_button(): Not implemented yet" );
}
在make时出现下面的问题:
和手册的一样啊,请问image_data和pixmapLabel1代表什么啊???
bool ret的作用,可以把他们注释掉吗??
解答问题的同时能否上传编写好的first.cpp???
谢谢!!!!!!!!!!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
亚瑟王 发表于 2009-9-1 17:48:48 | 显示全部楼层
image_data是我们源码中的带有logo图片的数组,你的源码中没有这个数组,所以会出错,你把这个数组屏蔽掉即可。
 楼主| xiaofuhaixia 发表于 2009-9-1 18:49:07 | 显示全部楼层
本帖最后由 xiaofuhaixia 于 2009-9-1 18:50 编辑

我改后的first.cpp
/****************************************************************************
** Form implementation generated from reading ui file 'first.ui'
**
** Created: 一  8月 31 16:07:26 2009
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.1.1   edited Nov 21 17:40 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "first.h"

#include <qvariant.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

/*
*  Constructs a first as a child of 'parent', with the
*  name 'name' and widget flags set to 'f'.
*/

first::first( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{  
    //QPixmap image0( ( const char** )image0_data );
    if ( !name )
        setName( "first" );
        resize(451,305);
        setCaption( tr("EmbedSky_First_Qt_Program") );

    user_b = new QPushButton( this, "user_b" );
    user_b->setGeometry( QRect( 60, 20, 100, 30 ) );
    user_b->setText( tr("User Button") );

    close = new QPushButton( this, "close" );
    close->setGeometry( QRect( 120, 140, 80, 28 ) );
    close->setText( tr("Close") );

    user_t = new QLabel( this, "user_t" );
    user_t->setGeometry( QRect( 20, 70, 188, 30 ) );
    QFont user_t_font(  user_t->font() );
    user_t_font.setPointSize( 18 );
    user_t_font.setBold( TRUE );
    user_t->setFont( user_t_font );
    user_t->setText( tr("") );
  

    //PixmapLabel1= new QLabel(this,"PixmapLabel1");
    //PixmapLabel1->setGeometry( QRect( 260, 20, 28, 98 ) );
    //PixmapLabel1->setPixmap( image0 );
    //PixmapLabel1->setScaledContents( TRUE );

    // signals and slots connections
    connect( user_b, SIGNAL( clicked() ), this, SLOT( user_button() ) );
    connect( close, SIGNAL( clicked() ), this, SLOT( close() ) );
}

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

/*
*  Sets the strings of the subwidgets using the current
*  language.
*/

//bool first::event(QEvent*ev)
//{    //bool ret = QWidget::event(ev);
   // if (ev->type()==QEvent::ApplicationFontChange)
// { QFont user_t_font(user_t->font());
//   user_t_font.setPointSize( 18 );
//   user_t_font.setBold( TRUE );
//   user_t->setFont( user_t_font );
// }
//  return ret;
//}


void first::user_button()
{     user_t->setText( tr("Hello,Qt Application !") );
    //qWarning( "first::user_button(): Not implemented yet" );
}
不知道现在对不对??编译时,环境变量是这样设的:
cd /opt/EmbedSky/Qte/x86-qtopia
. setenv
我想就相当于. x86-setenv吧??
手册里说,在pc机上仿真可以用编译器3.2.2,我就用的是3.2.2????
在板子上仿真用V61编译,我下了,在解压时,生成的目录自动把原来的3.4.5覆盖了,他们是不是一个啊???因为解压完成后,和原来的文件夹一样啊????
在改完first.cpp后,如上图所示,设置完环境变量,编译器3.2.2编译,当make时,出现下面的错误,不知道main.o为什么错误??怎么改??
谢谢!!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
 楼主| xiaofuhaixia 发表于 2009-9-1 18:51:35 | 显示全部楼层
在线等待,亚瑟王的解答。。
亚瑟王 发表于 2009-9-3 15:19:35 | 显示全部楼层
编译x86和交叉编译器无关,你的这个情况是没有发现那个头文件,我猜想可能你的Qt没有编译成功,导致有的头文件的连接没有产生。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-5-5 14:13 , Processed in 1.078125 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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