Qtopia Home · Home · Reference · User Guide · Internals


Qtopia applications can be built in one of four ways.

To facilitate switching between build modes, two macros are provided. They are to be used as follows (from examples/application/main.cpp):

    #include "example.h"
    #include <qtopiaapplication.h>


The first argument to QTOPIA_ADD_APPLICATION() must be a literal string that matches the binary name (ie. the value of TARGET from the .pro file). The build system defines QTOPIA_TARGET with the value of TARGET and it is recommended to use this macro. The second argument to QTOPIA_ADD_APPLICATION() should be the name of your class. If you use the wrong value you will get a compile failure.

Building for either quicklaunch or singleexec requires these macros but the build system cannot easily tell if you have used them and the penalty for a wrong guess could be disastrous. Therefore you must use the qtopia_main CONFIG value if you use these macros or the build system will assume your app is not quicklaunch-compatible. If your app uses these macros but does not handle quicklaunch or singleexec you can use the no_quicklaunch or no_singleexec CONFIG values.

Some applications cannot use the macros (eg. If you need to use a custom application class). This prevents the use of quicklauncher but you can still work with singleexec if you make some changes to your code. You need to use the singleexec_main CONFIG value and have a main.cpp that looks something like this (from examples/manual_main/main.cpp):

    #include "example.h"
    #include <qtopiaapplication.h>

    #ifdef SINGLE_EXEC
    #define MAIN_FUNC main_exampleapp
    #define MAIN_FUNC main

    // This is the storage for the SXE key that uniquely identified this applicaiton.
    // make will fail without this!

    int MAIN_FUNC( int argc, char **argv )
        // This is required to load the SXE key into memory

        QtopiaApplication a( argc, argv );

        // Set the preferred document system connection type

        Example *mw = new Example();
        if ( mw->metaObject()->indexOfSlot("setDocument(QString)") != -1 ) {
        } else {
        int rv = a.exec();
        delete mw;
        return rv;

Note that the second argument to QTOPIA_ADD_APPLICATION() is appended to main_ so that the main function has a unique name.

Note that packages cannot contain quicklaunched applications. See Package Limitations for more informtation.

See also Overviews, qtopia_main, no_quicklaunch, singleexec_main, no_singleexec, QTOPIA_TARGET, QTOPIA_ADD_APPLICATION(), QSXE_APP_KEY, QTOPIA_SET_DOCUMENT_SYSTEM_CONNECTION(), Quicklauncher, Qtopia Single Exec, and Project Files.

Copyright © 2008 Nokia Qtopia Build System Documentation