Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User sukumark123's Avatar
    Join Date
    Jul 2010
    Posts
    9
    Hi,
    I am using Qt creator 2.0.I with qt 4.7. am trying to write very simple code to access QSystemInfo, but I am getting following error when I build project
    QSystemInfo was not declared in this scope

    Here is the snipptet code
    #include <QLabel>
    #include <QSystemInfo>


    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QSystemInfo *s = new QSystemInfo;
    -----------------------------
    Here is my.pro file
    QT += core gui network

    TARGET = gps1
    TEMPLATE = app


    SOURCES += main.cpp\
    widget.cpp

    HEADERS += widget.h

    FORMS += widget.ui

    INCLUDEPATH += ../../src/systeminfo

    CONFIG += mobility
    MOBILITY += systeminfo
    ----------------------

    Appreciate any help.

    Thanks,
    Sukumar

  2. #2
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    using namespace QtMobility;

  3. #3
    Registered User sukumark123's Avatar
    Join Date
    Jul 2010
    Posts
    9
    danhicksbyron,

    Thank you very much for the tip. That change helped to build the project successfully. It is more than 10 years back, that I used C++. Need to refresh the concepts. Appreciate any pointers for beginners to use qt. I will go through the forums.

    Thanks,
    Sukumar

  4. #4
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    The namespace thing throws everyone for a loop -- I don't know why they did it, or why they don't do a better job of explaining the issue in the documentation.

Similar Threads

  1. error: 'QSensor' was not declared in this scope
    By mextil in forum [Archived] Qt Mobility Project
    Replies: 5
    Last Post: 2011-08-03, 14:52
  2. Replies: 1
    Last Post: 2010-12-10, 04:53
  3. Replies: 4
    Last Post: 2010-08-03, 12:22
  4. Replies: 1
    Last Post: 2010-07-06, 12:04
  5. root element not declared
    By Nokia_Archived in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2002-05-15, 20:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved