Building for the Emulator
Since Series 60 applications can be built from a command prompt or from within an IDE, we have detailed both methods here. We'll start by building the project to run under the PC-hosted emulator (that is, for an x86 instruction set) using the C++ compiler supplied with the IDE. We almost always use a debug build, so that symbolic debug information and memory-leak checking are available (checking for memory dynamically allocated on the heap that is not released correctly).
Building from the Command Line
Open a command prompt and change to the drive/folder that contains your Series 60 SDK. Navigate to the folder where the project definition (helloworld.mmp) and component description (bld.inf) files are locatedfor example:
\Symbian\Series602_0\EMCCSoft\HelloWorld\group
for a Series 60 2.x project
or \Symbian\6.1\Series60\EMCCSoft\HelloWorld\group
for a Series 60 1.x project
and type:
bldmake bldfiles
After a second or two this command completes without any visual output. It uses the bld.inf and helloworld.mmp files to generate a new file: abld.bat. This command file is always generated in place, as required. Unlike the bld.inf and .mmp files, abld.bat is not portable between different IDEs and should never be edited by hand.
To compile and link the project, type:
abld build wins udeb |
for Visual C++ |
abld build winsb udeb |
for Borland C++ |
abld build winscw udeb |
for CodeWarrior |
The abld command will build the project (in other words, compile and link) for the Series 60 emulator (the wins, winscw or winsb variant) with debugging (udebUnicode debug) information included in the binary executable.
Building from an IDE
Projects, such as our example HelloWorld application, normally are built and run from within an IDE, so we need to create IDE-specific project files from the bld.inf and HelloWorld.mmp files. For Visual C++ this must be performed from the command line, using tools supplied by Symbian. For Borland and CodeWarrior this is optional, since both IDEs can import either the bld.inf or .mmp file, respectively, to create the IDE project files.
When working from the command prompt it may be necessary to create the abld.bat file if it does not exist already, or recreate it if the .mmp file or bld.inf file has changed. At a command prompt you create the abld command file by typing:
bldmake bldfiles
Building Using Microsoft Visual C++ IDE
Open a command prompt and navigate to the drive/project folder for the HelloWorld project and then type:
abld makefile vc6
This will create project and workspace files (helloworld.dsp and .dsw files) suitable for Microsoft Visual C++. They will be located under the \Epoc32\Build sub-folder structure; the complete path will depend on the location of your SDK, for example:
\Epoc32\Build\EMCCSoft\HelloWorld\HelloWorld\Wins
By opening the workspace file (helloworld.dsw) in Visual C++, you can compile or link the application, either by pressing F7 or via the IDE menu option, Build|Build HelloWorld.app.
Building Using Borland C++IDE Builder 6
If you are using Borland C++Builder 6 Mobile Edition, which is based on C++Builder 6 Personal Edition with the Mobile plug-in, you can simply import the bld.inf file for the HelloWorld project into the IDE. Use the File|New|Other menu option. Then select the Mobile tab in the resulting dialog: Import Mobile Application. Browse to the location of the component description (bld.inf) file and open it.
Use Ctrl+F9, or Project|Make from the menu, to build. To build and run, use F9 or Run|Run from the menu. Note that F9 or Run|Run will cause a project rebuild each time! To just run the emulator, use Tools|Mobile Build Tools|Run Emulator. You may be prompted to save a number of project-related files, for example, Borland project (.bpr), Borland project group (.bpg) files. These files will be saved in the same folder as your bld.inf file.
It is also possible to execute individual abld commands and run other SDK tools such as aifbuilder and sisar from the Tools|Mobile Build Tools menu. These tools are described in Chapter 2.
Building Using Borland C++BuilderX
When using any of the commercial C++BuilderX products, you can simply import the bld.inf file for the HelloWorld project into the IDE.
Use File|New and click the Mobile C++ tab in the Object Gallery. Select Import Symbian C++ Project. Select the correct Series 60 SDK from the drop-down list, browse to the location of the project bld.inf file. Press the Next tab, give the project a name, press the Finish tab and the project will open. Press Ctrl+F9 or select Project|Make Project. To run, Press F9, or select Run|Run Project or use the toolbar tab to Make and Run the project.
Building Using CodeWarrior IDE
If you are using Metrowerks CodeWarrior for Symbian (Personal v2.5, other editions may vary slightly), you can simply import the HelloWorld.mmp file using the IDE menu option, File|Import Project from .mmp File.
This runs a project conversion wizard. Select the SDK to use with this project, select (or browse to) the .mmp file, and select a platform of WINSCW (or all by leaving it blank). The build variant will default to UDEB. Use F7 or Project|Make from the menu to build the project.
The CodeWarrior Project files (.mcp, .xml, .resources and .pref files) are created automatically in the same directory as the HelloWorld.mmp file.
Alternatively you can create a CodeWarrior IDE project from the command line. To do this, run bldmake bldfiles as described; then, to generate a CodeWarrior IDE project, use:
abld makefile cw_ide
This creates an importable project file HelloWorld.xml in the directory:
\Epoc32\Build\EMCCSoft\HelloWorld\HelloWorld\Winscw
You can now use CodeWarrior to import this file and to generate a native project (.mcp) file. Choose the File|Import Project menu option, select the HelloWorld.xml file, and choose a name for the project (such as HelloWorld again). CodeWarrior will now generate and load the project, which you can build, run, debug and so on, using the normal IDE commands.