Developers Notebook-WxWinCECompiling

From WxWiki
Jump to navigation Jump to search

Compiling wxWinCE for Windows Mobile 5.0 (PocketPC and Smartphone)

Build wxWinCE 2.8 for Windows Mobile 5 with Visual Studio 2005

  • you should have installed the smart device compilers for C++ in your visual studio installation. if not insert the install cd and add them
  • if needed modify include/wx/msw/setup.h
  • in vs2005 open build/wince/wx.vcw and convert it to vs2005 project
  • compile it (twice if pb with clthumb.exe)
  • copy built libraries from "build\wince\Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Debug" to "lib\evc_armv4t_lib\winced"
  • open samples/minimal project, choose windows mobile 5 platform, and correct the libraries names and path in project properties

Build the wxWinCE libraries

You will need wxWidgets 2.6.3 RC2 or later to create Windows Mobile 5.0-specific applications or Pocket PC 2003 applications that will work correctly on Windows Mobile 5.0.

To build Windows Mobile 5.0-specific applications you need Visual Studio 2005, which costs money, but to build Pocket PC or Smartphone 2003 applications that will also run on Windows Mobile 5.0 devices, you only need Embedded Visual C++ 4.0, which is free. This section assumes you are using Visual Studio 2005.

Before compiling wxWidgets, install VS 2005 and download and install the required SDKs: Windows Mobile 5.0 Pocket PC and/or Windows Mobile 5.0 Smartphone. Be sure to install these BEFORE you open any wxWidgets projects.

Open build/wince/wx.vcw in VS 2005. It will prompt you to convert all project files, convert them. When the conversion finishes, VS 2005 should list 6 'Solutions' in the Solutions Explorer ( gl, mono, wxexpat, wxjpeg, wxpng, wxzlib). You will need to adjust setting in each of those projects to make it compile. To change the properties for each project in the workspace, Right-click on the project, and select "Properties". In the tree on the left side, go to "Configuration Properties | Librarian | General | Output File", and edit it so it reads (for example) ..\..\lib\$(PlatformName)\$(ConfigurationName)\wx_mono.lib.

Set under C/C++/Precompiled Header the value of Create/Use Precompiled Header to Not Using Procompiled Header (only under workspace gl and mono).

Then set the current configuration to the desired one (for example, Windows Mobile 5.0 Pocket PC) and compile each project. You may get some strange errors about a missing clthumb command but try again with F7 and eventually it will compile (only if you forget the precompiled header option).

Build a sample program

Now, open and convert a sample project, for example samples/minimal. Again, you will need to adjust some properties. In the project properties, edit "Linker | General | Additional Library Directories" so it includes "..\..\lib\$(PlatformName)\$(ConfigurationName)". Also change "Linker | Input | Additional Dependencies" property to something like: coredll.lib wx_mono.lib wx_wxjpeg.lib wx_wxpng.lib wx_wxzlib.lib wx_wxexpat.lib commctrl.lib winsock.lib wininet.lib

Now set the configuration, compile, and run the project. The emulator runs ARM applications directly so in VS 2005 there is no need to build separately for emulation.

If you receive unresolved symbol errors having to do with 'eh vector destructor iterator', your project probably depends upon runtime type information. You can solve the problem by adding ccrtrtti.lib to "Linker | Input | Additional Dependencies"

For new projects make sure you include the wxWidgets rc file wx/msw/wx.rc in your project's rc file. If you dont include it, you will get exceptions when creating the Menubar. [1]

Compiling wxWinCE for Windows Mobile 2003 (PocketPC)

These instructions are only meant to be a complimentary guide to the official wxWinCE installation documentation which can be found at "docs/msw/wince/readme.txt" or online (2.8). Please read all of the official documentation first.

Note : These are the steps I followed to get minimal and one of my own apps to compile and run on an iPAQ 4150.

First, you must download and install all of the following (in this order):

  1. eMbedded Visual C++ 4.0
  2. Service Pack 4 for eVC4
  3. Developer Resources for Windows Mobile 2003 Second Edition
  4. SDK for Windows Mobile 2003-based Pocket PCs

Then download and extract wxWidgets 2.6.x for Windows zip file from : https://www.wxwidgets.org/downloads/.

Rebuild wxWidgets for WinCE as follows:

  1. Open C:\wxWinCE\build\wince\wx.vcw
  2. Rebuild each of the six projects in the ClassView by right clicking on the project, selecting "Set as Active Project", and selecting Rebuild from the Build menu.

Now you can open the minimal sample (minimal.vcw) and rebuild that.

If you wish to create your own project then these are the steps I followed to create a project and import an existing wxWidgets application.

  1. File | New | Projects | "WCE Pocket PC 2003 Application"
  2. Enter project name and location.
  3. Choose "An empty project"
  4. Click Finish
  5. Select OK
  6. Project | Add to project | Files
  7. Add all of the required files to the project.
  8. <Alt F7>
  9. C/C++ | Precompiled Headers | Not using precompiled headers
  10. C/C++ | Preprocessor | Preprocessor definitions
    • ARM,_ARM_,ARMV4,UNDER_CE=$(CEVersion),_WIN32_WCE=$(CEVersion),
    • UNICODE,_UNICODE,$(CePlatform),DEBUG,__WXWINCE__,__WXDEBUG__,
    • NOPCH,wxNO_EXCEPTIONS,wxNO_RTTI
  11. C/C++ | Preprocessor | Additional include directories:
    • C:\wxWinCE\include,C:\wxWinCE\lib\evc_armv4_lib\winced
  12. Link | Object/library modules:
    • coredll.lib wxwince25d.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib winsock.lib wininet.lib
  13. Link | Additional library path
    • C:\wxWinCE\lib\evc_armv4_lib

Compiling wxWinCE for Windows CE 3.0 (PocketPC)

  • Download and install Embedded Visual Tools 3.0 2002 if you don't already have it
  • Download wxWidgets from CVS (head), daily snapshots here
  • If Project files now are not in the CVS (yet?), they must be generated with bakefile, see docs/tech/tn0016.txt for more information. You may choose the CPU(s) for which you want to include the configurations in the project file. The emulator configuration is always included.
  • (2004-11-18) The project files in the CVS snapshot are stored with linux linefeeds. You must re-save them with windows linefeeds.
    • One way to convert the linefeeds in the vcw/vcp files is to follow these steps:
      • Open each file with the Visual Studio .NET IDE
      • On the File menu, select "Advanced Save Options"
      • Change the "Line endings" combo box to "Windows (CR LF)"
      • Click "Ok"
      • On the File menu, select "Save"
  • Open build/wince/wx.vcw, select the appropriate configuration ("WIN32 (WCE emulator) Debug" if using an emulator or another), close the dialog, then select Pocket PC 2002 and Pocket PC 2002 Emulation on the toolbar, and compile. There may be long delays while VC++ computes dependencies, and expect to wait a long time for loading and saving the workspace.
  • Open samples/minimal/minimal.vcw, select the same configuration as was used for building the library and build.

The setup file for wxWinCE is in include/wx/msw/wince/setup.h. Some features are currently switched off for the port to compile but most of them are available.

Compiling wxWinCE for Windows CE 4.x (embedded platforms)

� see also below


Step-byStep instructions to build wxWinCE.NET

1. Get bakefile binaries

  • NOTE: in lack of workspace and project files for eVC IDE in source tree of wxWidgets you should build them yourself using Bakefile.
Homepage : http://bakefile.sourceforge.net
  • Installer for Windows. The package is self-contained, you don't have to install Python separately, small version of Python 2.3 runtime is included.
Download : http://bakefile.sourceforge.net/download.php


2. Bakefile and Python installation

  • Download and install bakefile-0.1.4-setup.exe
  • Add bakefile to %PATH% or call it with full path when required
 (for example) C:\Programmi\Bakefile\src\bakefile_gen

3. Prepare Bakefiles.bkgen for eVC++4

  • Edit build\bakefiles\Bakefiles.bkgen and remove the word "msevc4prj" (without quotes) from

<disable-formats> section directive, like this:

<disable-formats>dmars,dmars_smake,cbx_unix,cbuilderx</disable-formats>


3. Generate Bakefiles for eVC++4

  • md %WXWIN%\build\wince <= VERY IMPORTANT !
  • cd %WXWIN%\build\bakefiles
  • C:\Programmi\Bakefile\src\bakefile_gen -f msevc4prj

Note that last step builds over 100 project files. Save your time and use -b parameter to build selected files.

Now you have the .VCW file in %WXWIN%\build\wince


4. Build using eVC++4

  • open workspace %WXWIN%/build/wince/wx.vcw (Marco and Julian tried with eVC4, ABX tried with eVC3)
  • (VC8 works but the project import doesn't preserve output libary names or paths so you'll have to massage sample project files a bit)
  • select type of build (debug/unicode)
  • select target
  • In sequence build
    • wxzlib
    • wxjpeg
    • wxexpat
    • gl
    • mono
  • open workspace in one of samples folder
  • select the same settings for type of build and target
  • build (and run if targeted to emulator)

If you get error LNK1166, browse to this page and search for LNK1166 (It's written for eVC++4 but applies to VC8 as well)

http://download.microsoft.com/download/a/7/3/a735c7fb-dcbd-429f-9090-d09b3b15d3fa/ReleaseNotes.htm