Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Windows CE - Working with Custom SDKs

When working with a custom SDK for Windows CE, Qt provides an easy way to add support for it to your development environment. The following is a tutorial that covers how to create a specification for Qt for Windows CE platforms.

Creating a Custom Build Specification

Create a subdirectory in the mkspecs folder of the Qt directory. New specifications for Qt for Windows CE following this naming convention:

 wince<version><SDK-shortcut>-[architecture]-msvc2005

Using this convention makes it possible for qmake to identify that you are building Qt for Windows CE, and will customize the compilation process accordingly.

Create the files qmake.conf and qplatformdefs.h inside the new specification directory. Take a look at the implementation of the other Windows CE specifications included in the mkspecs directory to see what is required to build Qt for Windows CE successfully.

Fine-Tuning Options

Compared to the desktop versions, Qt for Windows CE needs two additional options:

  • CE_SDK specifies the name of the SDK.
  • CE_ARCH specifies information about the target architecture.

Following is an example configuration for the Windows Mobile 5 for Pocket PC SDK:

 CE_SDK        = Windows Mobile 5.0 Pocket PC SDK
 CE_ARCH       = ARMV4I

Note: qmake uses this information to build a valid Visual Studio project file. You need to ensure that they are identical to the configuration of the custom SDK, otherwise you might not be able to compile or debug your project with Visual Studio.

Additionally, most Windows CE SDKs use extra compiler options. These can be specified by expanding the DEFINES value.

For example, with Windows Mobile 5 for Pocket PC, the DEFINES variable is expanded in the following way:

 DEFINES      += UNDER_CE WINCE _WINDOWS _UNICODE UNICODE _WIN32_WCE=0x501 $$CE_ARCH _ARMV4I_ armv4i _ARM_ ARM _M_ARM ARM _WIN32 __arm__ Q_OS_WINCE_WM QT_NO_PRINTER QT_NO_PRINTDIALOG

The mkspec may require additional configuration to be used inside of Visual Studio, depending on the Windows CE SDK. The above example defines _M_ARM. This definition is available internally in Visual Studio. Hence, the compiler will warn you about redefinition during the build step. These warnings can be disabled by adding a default_post.prf file containing the following lines, within the subdirectory.

 if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) {
     DEFINES -= _M_ARM
 }

Cross-compilation Environment for a Custom SDK

Qt for Windows CE supports a convenience script, setcepaths.bat, that prepares the environment in a command prompt for cross-compilation. However, on custom SDKs, the checksdk tool is provided to identify the environment, so Qt compiles successfully.

checksdk is generated during the configure step and allows for the following options:

  • list: Returns a list of available Windows CE SDKs. (This list may contain one or more SDKs not supported on Qt for Windows CE, e.g., Pocket PC 2003.)
  • sdk: The parameter to specify an SDK. Returns a setup of environment variables that must be set to cross-compile Qt.
  • script: Stores your setup in a .bat file. This simplifies the process of switching environments when you load a command prompt in future.

Compiling Qt for a Custom SDK

Windows CE is highly customizable, hence it is possible that some SDKs have feature-stripped setups. Depending on the SDK's configuration, Qt may not compile in its standard configuration, as Qt for Windows CE is designed to be compatible with the Standard SDK setup.

However, it is possible to exclude features of Qt and create a version that compiles for the desired SDK.

Further information on stripping features can be found in the QFeatures documentation.

Making Qt Applications Start on a Custom Device

Sometimes, a Windows CE device has been created with a configuration different from the corresponding SDK's configuration. In this case, symbols that were available at linking stage will be missing from the run-time libraries.

Unfortunately, the operating system will not provide an error message that mentions which symbols are absent. Instead, a message box with the following message will appear:

app.exe is not a valid CE application!

To identify the missing symbols, you need to create a temporary application that attempts to dynamically load the Qt for Windows CE libraries using LoadLibrary. The following code can be used for this:

 wchar_t* libraries[] = {
     L"QtCore4.dll",
     L"QtGui4.dll",
     0
 };

 for (int i = 0; libraries[i] != 0; ++i) {
     HINSTANCE instance = LoadLibraryW(libraries[i]);
     OutputDebugStringW(libraries[i]);
     if (instance != NULL) {
         OutputDebugStringW(L" : Successfully instantiated\n");
         FreeLibrary(instance);
     } else {
         OutputDebugStringW(L" : Could not be loaded\n");
     }
 }

Once you have compiled and deployed the application as well as the Qt libraries, start a remote debugger. The debugger will then print the ordinal number of the unresolved symbol.

Search for parts of Qt that rely on these functions and disable them using the QFeatures functionality.

In our experience, when Qt applications do not start on Windows CE, it is usually the result of missing symbols for the following classes or features:

Please refer to the Microsoft documentation here for information on what ordinals are and how you can create them. Information on accessing the corresponding symbol name to a given ordinal value can also be found in the Microsoft documentation.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web