×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Q_OS_SYMBIAN macro does not work

    Hi everybody
    In order to write symbian programs in Qt creator, I used Q_OS_SYMBIAN macro but it does not work. I tried Q_WS_S60 macro but it does not work too.
    I used these macroe like below:
    Code:
    #if defined (Q_OS_SYMBIAN)
    // TInt i;
    // ....
    #endif
    After the execution I recieve a error message that those macros are undefined.
    How can I solve the problem?

    Thanks.

  2. #2
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    Re: Q_OS_SYMBIAN macro does not work

    Check this article this may help you http://wiki.forum.nokia.com/index.ph..._In_Qt_Project

  3. #3
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Q_OS_SYMBIAN macro does not work

    A more appropriate article to refer will be this one. Also check if you have the SDK installed properly and you have the right build configurations.

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Q_OS_SYMBIAN macro does not work

    Quote Originally Posted by ehsanTC View Post
    Hi everybody
    In order to write symbian programs in Qt creator, I used Q_OS_SYMBIAN macro but it does not work. I tried Q_WS_S60 macro but it does not work too.
    I used these macroe like below:
    Code:
    #if defined (Q_OS_SYMBIAN)
    // TInt i;
    // ....
    #endif
    After the execution I recieve a error message that those macros are undefined.
    How can I solve the problem?

    Thanks.
    can you let us see how the error looks in the console window. as for me Q_OS_SYMBIAN works fine . As far as i know #if defined does not give rise to a run time error.

  5. #5
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Q_OS_SYMBIAN macro does not work

    Hi friends
    My code is here:
    Code:
    1. #include "mainwindow.h"
    2.#include <QtGui/QApplication>
    3.
    4. #ifdef Q_OS_SYMBIAN
    5. // Need these includes to lock orientation in Symbian
    6.    #include <eikenv.h>
    7.    #include <eikappui.h>
    8.    #include <aknenv.h>
    9.    #include <aknappui.h>
    10.#else
    11.   #warning :Q_OS_SYMBIAN not defined
    12.#endif
    13.
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
        mainWindow.showExpanded();
        QString temp;
    
    #ifdef Q_OS_SYMBIAN
        TInt i=9;
        QVariant iVar =i ;
        if ( iVar.canConvert<QString>())
        {
            temp = "The type TInt converted successfully to string\nTInt i==" ;
            tem += i.toString() ;
            mainWindow.Text ( temp );
        }
    
    #elif defined(Q_OS_SYMBIAN)
        TInt i=9;
        QVariant iVar =i ;
        if ( iVar.canConvert<QString>())
        {
            temp = "No Q_WS_S60 defined.\n"+
                    "The type TInt converted successfully to string\nTInt i==" ;
            tem += i.toString() ;
            mainWindow.Text ( temp );
    
        }
    #elif defined(Q_WS_MAEMO_5)
        TInt i=9;
        QVariant iVar =i ;
        if ( iVar.canConvert<QString>())
        {
            temp = "No Q_WS_S60 and Q_OS_SYMBIAN defined.\n"+
                    "The type TInt converted successfully to string\nTInt i==" ;
            tem += i.toString() ;
            mainWindow.Text ( temp );
        }
    
    #else
        temp = "No Q_WS_S60 and Q_OS_SYMBIAN and Q_WS_MAEMO_5 defined";
        mainWindow.Text (temp);
    #endif
    
        return app.exec();
    }
    I get the #warning :Q_OS_SYMBIAN not defined at line 11 and none of instructions inside the macro blocks in the main function execute.
    I used a simple Text() function to write a string on the phone display.
    Regards

  6. #6
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Q_OS_SYMBIAN macro does not work

    My project file is:
    Code:
    DEPLOYMENTFOLDERS = # file1 dir1
    
    symbian:TARGET.UID3 = 0xEA621786
    
    symbian:TARGET.CAPABILITY += NetworkServices
    
    SOURCES += main.cpp mainwindow.cpp
    HEADERS += mainwindow.h
    FORMS += mainwindow.ui
    
    include(deployment.pri)
    qtcAddDeployment()
    
    symbian {
        LIBS += -lcone -leikcore -lavkon
    }

  7. #7
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: Q_OS_SYMBIAN macro does not work

    And in Qt Creator which is the target you have chosen to build the project?

  8. #8
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Q_OS_SYMBIAN macro does not work

    When I wanted to create project, I just chose the Mobile Project and in the .pro file added three lines of code.

  9. #9
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Q_OS_SYMBIAN macro does not work

    Quote Originally Posted by ehsanTC View Post
    When I wanted to create project, I just chose the Mobile Project and in the .pro file added three lines of code.
    but did you choose "symbian " target ? by default it is emulator so QtCreator is working properly for that ;-)

  10. #10
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Q_OS_SYMBIAN macro does not work

    Quote Originally Posted by ehsanTC View Post
    Hi friends
    My code is here:
    Code:
    1. #include "mainwindow.h"
    2.#include <QtGui/QApplication>
    3.
    4. #ifdef Q_OS_SYMBIAN
    5. // Need these includes to lock orientation in Symbian
    6.    #include <eikenv.h>
    7.    #include <eikappui.h>
    8.    #include <aknenv.h>
    9.    #include <aknappui.h>
    10.#else
    11.   #warning :Q_OS_SYMBIAN not defined
    12.#endif
    13.
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
        mainWindow.showExpanded();
        QString temp;
    
    #ifdef Q_OS_SYMBIAN
        TInt i=9;
        QVariant iVar =i ;
        if ( iVar.canConvert<QString>())
        {
            temp = "The type TInt converted successfully to string\nTInt i==" ;
            tem += i.toString() ;
            mainWindow.Text ( temp );
        }
    
    #elif defined(Q_OS_SYMBIAN)
        TInt i=9;
        QVariant iVar =i ;
        if ( iVar.canConvert<QString>())
        {
            temp = "No Q_WS_S60 defined.\n"+
                    "The type TInt converted successfully to string\nTInt i==" ;
            tem += i.toString() ;
            mainWindow.Text ( temp );
    
        }
    #elif defined(Q_WS_MAEMO_5)
        TInt i=9;
        QVariant iVar =i ;
        if ( iVar.canConvert<QString>())
        {
            temp = "No Q_WS_S60 and Q_OS_SYMBIAN defined.\n"+
                    "The type TInt converted successfully to string\nTInt i==" ;
            tem += i.toString() ;
            mainWindow.Text ( temp );
        }
    
    #else
        temp = "No Q_WS_S60 and Q_OS_SYMBIAN and Q_WS_MAEMO_5 defined";
        mainWindow.Text (temp);
    #endif
    
        return app.exec();
    }
    I get the #warning :Q_OS_SYMBIAN not defined at line 11 and none of instructions inside the macro blocks in the main function execute.
    I used a simple Text() function to write a string on the phone display.
    Regards
    Let me correct it, just the last block codes
    Code:
    #else
    .....
    #endif
    executes

  11. #11
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Q_OS_SYMBIAN macro does not work

    Quote Originally Posted by skumar_rao View Post
    but did you choose "symbian " target ? by default it is emulator so QtCreator is working properly for that ;-)
    you mean, what should I do to change the target?
    I have to add something to .pro file?

  12. #12
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Q_OS_SYMBIAN macro does not work

    In the IDE go to Help -> Contents -> Qt Creator -> Getting started -> Building and Running an Example Application. Read that and learn about targets and target selection.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  13. #13
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Q_OS_SYMBIAN macro does not work

    This article might be helpful to use to create Qt mobile application for Symbian platform.
    http://wiki.forum.nokia.com/index.ph...r_with_Symbian

  14. #14
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Q_OS_SYMBIAN macro does not work

    Quote Originally Posted by savaj View Post
    This article might be helpful to use to create Qt mobile application for Symbian platform.
    http://wiki.forum.nokia.com/index.ph...r_with_Symbian
    i did not understand how this is helpful for "Q_OS_SYMBIAN macro does not work"

  15. #15
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Q_OS_SYMBIAN macro does not work

    When I want to create a new mobile project in the "Qt Versions" level in the creating new project, that we can choose
    Desktop, Maemo, Qt Simulator or Symbian Device, there is problem identifiers (yellow triangle)
    in front of "Qt 4.7.2 for Symbian^1(Qt SDK)" and "Qt 4.7.2 for Symbian^3(Qt SDK)".
    Additionally, when I want to run the project for the Symbian Device, it can not run, but for Maemo or simulator it runs.

    Can it become the reason for the problem?

Similar Threads

  1. SetTimeFormatStringL does not work.
    By ovtchinnikov in forum Symbian User Interface
    Replies: 2
    Last Post: 2010-11-16, 04:13
  2. eshell does not work.
    By Vink in forum Symbian
    Replies: 2
    Last Post: 2009-05-14, 09:07
  3. verisign does not work
    By eroslin in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 3
    Last Post: 2008-06-24, 08:55
  4. acceptAndOpen does not work
    By D|3-H4rD in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2006-08-29, 23:54
  5. TabChangedL does not work
    By huangh in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-12-26, 09:10

Posting Permissions

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