[Moved] Define a macro on Qt for Embedded Linux



  • I try to define a macro for Embedded Linux project. this is what i write:

    @
    #ifdef Q_WS_WIN // Windows
    const QString BASE_DIRECTORY = "C:/path/on/windows";
    #elif defined(Q_WS_QWS) || defined(Q_WS_QPA) // Embedded linux
    const QString BASE_DIRECTORY = "/path/on/board";
    #else // Linux
    const QString BASE_DIRECTORY = "/home/path/on/linux-ubuntu";
    #endif // OS type
    @

    on the board that is Embedded Linux *lighthouse * version the BASE_DIRECTORY is equal to
    "/home/path/on/linux-ubuntu" .

    how can i figure out the OS version, and fix it?

    tnx



  • I think this not right branch of forum to ask such questions. Post in Mobile and Embedded.


  • Moderators

    [quote author="Anticross" date="1325160416"]I think this not right branch of forum to ask such questions. Post in Mobile and Embedded.[/quote]

    This might not be the best place to post for everything, but reposting the same thing in different forums is not a good solution either. Someone of the moderators will eventually move the topic.



  • where i can post this question exactly to get any help?


  • Moderators

    [quote author="goli" date="1325076024"]I try to define a macro for Embedded Linux project. this is what i write:

    @
    #ifdef Q_WS_WIN // Windows
    const QString BASE_DIRECTORY = "C:/path/on/windows";
    #elif defined(Q_WS_QWS) || defined(Q_WS_QPA) // Embedded linux
    const QString BASE_DIRECTORY = "/path/on/board";
    #else // Linux
    const QString BASE_DIRECTORY = "/home/path/on/linux-ubuntu";
    #endif // OS type
    @

    on the board that is Embedded Linux *lighthouse * version the BASE_DIRECTORY is equal to
    "/home/path/on/linux-ubuntu" .

    how can i figure out the OS version, and fix it?

    tnx

    [/quote]
    What do you mean with figuring out the OS?
    Typically the information you are using in your example would be part of some defines you are using.



  • i need to define a path that will be avalible only on the embedded system and i can't find the right define to achieve that.
    In the example you can see that I try
    @#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) // Embedded linux
    @
    but it does not work and i entered into the default:
    @#else // Linux
    const QString BASE_DIRECTORY = "/home/path/on/linux-ubuntu";
    #endif // OS type
    @


  • Moderators

    I guess you have compiled Qt for cross-compilation to use with your embedded platform.
    Duirng configuration there is typically a sequence like "-xplatform qws/linux-arm-g++" for example. All default macro definitions can be found in "mkspecs/qws/linux-arm-g++" in your cross compiled installation (respective any compilation). Probably you have to follow different include files until you find the master. However, there you find all definitions for compilation.



  • what are the definitions if I use lighthouse and not qws? I could not find any information in "mkspecs/qws/linux-arm-g++” file


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.