×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    Unhappy first application batteryindiacator giving error :(

    Hello All,
    I am a first time user and getting the following errors...
    first its saying for the QSystemDeviceInfo *deviceInfo; --- >
    syntax error:missing ';' before *

    i have pasted all my project file, header and source file...I have followed their instruction exactly but things not working.....help needed..can anyone help????

    =============================================================




    #ifndef BATTERYIND_H
    #define BATTERYIND_H

    #include <QSystemInfo>
    #include <QDialog>

    namespace Ui {
    class batteryind;
    }

    class batteryind : public QDialog
    {
    Q_OBJECT


    public:
    explicit batteryind(QWidget *parent = 0);
    ~batteryind();

    private:
    Ui::batteryind *ui;
    void setupGeneral();
    QSystemDeviceInfo *deviceInfo;
    };

    #endif // BATTERYIND_H
    ===========================================================


    #include "batteryind.h"
    #include "ui_batteryind.h"

    batteryind::batteryind(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::batteryind),
    deviceInfo(NULL)
    {
    ui->setupUi(this);
    setupGeneral();
    }

    batteryind::~batteryind()
    {
    delete ui;
    }

    void batteryind::setupGeneral()
    {
    deviceInfo = new QSystemDeviceInfo(this);

    ui->batteryLevelBar->setValue(deviceInfo->batteryLevel());

    connect(deviceInfo, SIGNAL(batteryLevelChanged(int)),
    ui->batteryLevelBar, SLOT(setValue(int)));
    }
    ====================================================

    #include <QtGui/QApplication>
    #include "batteryind.h"

    QTM_USE_NAMESPACE
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    batteryind w;

    w.showMaximized();


    return a.exec();
    }
    ========================================

    #-------------------------------------------------
    #
    # Project created by QtCreator 2010-08-28T23:19:45
    #
    #-------------------------------------------------

    QT += core gui

    TARGET = batteryind
    TEMPLATE = app


    SOURCES += main.cpp\
    batteryind.cpp

    HEADERS += batteryind.h

    FORMS += batteryind.ui

    CONFIG += mobility
    MOBILITY += systeminfo

    symbian {
    TARGET.UID3 = 0xe17573bd
    # TARGET.CAPABILITY +=
    TARGET.EPOCSTACKSIZE = 0x14000
    TARGET.EPOCHEAPSIZE = 0x020000 0x800000
    }

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: first application batteryindiacator giving error :(

    You should write:

    Code:
    QSystemDeviceInfo* deviceInfo;
    in place of

    Code:
    QSystemDeviceInfo *deviceInfo;
    Then tell me the result.

  3. #3
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: first application batteryindiacator giving error :(

    Quote Originally Posted by rahulvala View Post
    You should write:

    Code:
    QSystemDeviceInfo* deviceInfo;
    in place of

    Code:
    QSystemDeviceInfo *deviceInfo;
    Then tell me the result.

    I think the declaration should works in any of the manner stated by you. It is not the soure of the error.


    BTW try to use QTM_USE_NAMESPACE into your batteryind.h file.

    One more thing, If it doesn't help than try to run some mobility examples that are come with Qt for checking if your Qt mobility is configured properlyy or not.
    Jajal Mehul

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: first application batteryindiacator giving error :(

    Quote Originally Posted by rahulvala View Post
    You should write:

    Code:
    QSystemDeviceInfo* deviceInfo;
    in place of

    Code:
    QSystemDeviceInfo *deviceInfo;
    Then tell me the result.
    The two are identical. You could just as correctly write the line with no spaces at all.

  5. #5
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: first application batteryindiacator giving error :(

    What it's saying, in its own obscure fashion, is that "QSystemDeviceInfo" isn't recognized as a type/class name. (If not a type/class then it must be a variable, and the compiler's having a conniption figuring out what a variable name is doing in that location.)

    In this case, the problem is that all Mobility interfaces are declared in the QtMobility namespace. Ie, the full name of the class is QtMobility::QSystemDeviceInfo. By including the QTM_USE_NAMESPACE macro call ahead (physically in the file) of any mention of a Mobility class name, however, you "imply" the namespace, sort of like doing an "import" in Java, so that you don't need to explicitly spell out the namespace in every use.

  6. #6
    Registered User
    Join Date
    Aug 2010
    Posts
    2

    Re: first application batteryindiacator giving error :(

    Thanks all for your help...james your trick worked...thanks for ur time..all of ull!!


    Quote Originally Posted by james1980 View Post
    I think the declaration should works in any of the manner stated by you. It is not the soure of the error.


    BTW try to use QTM_USE_NAMESPACE into your batteryind.h file.

    One more thing, If it doesn't help than try to run some mobility examples that are come with Qt for checking if your Qt mobility is configured properlyy or not.

  7. #7
    Registered User
    Join Date
    May 2011
    Posts
    1

    Re: first application batteryindiacator giving error :(

    I tried the examples they worked flawlessly, however, in case of this batteryindicator project I am still on danger level :P with plenty of errors starting with the one mentioned below. QT_USE_NAMESPACE is in batteryindicator.h and

    class BatteryIndicator : public QDialog
    {
    Q_OBJECT

    public:
    explicit BatteryIndicator(QWidget *parent = 0);
    ~BatteryIndicator();

    private:
    Ui::BatteryIndicator *ui;
    void setupGeneral();
    QSystemDeviceInfo* deviceInfo; <- This is where I get this error batteryindicator.h:26: error: C2143: syntax error : missing ';' before '*'

    };
    Last edited by ali302; 2011-05-16 at 16:55.

Similar Threads

  1. Replies: 12
    Last Post: 2010-08-27, 13:00
  2. GPS problem..giving an error
    By poojs in forum Mobile Java General
    Replies: 4
    Last Post: 2009-09-01, 12:53
  3. TC-ConvertP12 giving error
    By Prexa in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 5
    Last Post: 2008-07-08, 08:06
  4. My 6600 is giving MontyThread Error
    By ummarbhutta in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-03-21, 20:56
  5. HTTPClient giving error:-33
    By vvsnaresh in forum Symbian
    Replies: 0
    Last Post: 2005-10-19, 13:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×