Commandline project

Creating workspace folders

When building through the commandline, a project workspace will contain a build file, a project file, resource files and a batchfile to ease the building process. Create a workspace folder for each Symbian platform:

C:\projects\helloworld\workspace_s60
C:\projects\helloworld\workspace_s80
C:\projects\helloworld\workspace_s90
C:\projects\helloworld\workspace_uiq

The build file

The build file contain a reference to the project file, and the supported target architectures (such as a device build, or an emulator build). Add bld.inf to each workspace folder:

bld.inf (6 lines)
  1. PRJ_MMPFILES
  2. helloworld.mmp
  3.  
  4. PRJ_PLATFORMS
  5. GCCE
  6. WINSCW

The PRJ_PLATFORMS section only needs to be added for the Symbian 9+ SDKs, such as S60 third edition and UIQ 3.0. The following project platforms can be used: GCCE, WINS and/or WINSCW.

The project file

The project file contains general build information such as the name of the application and unique identification number. It contains source files, header files, resource files, libraries and additional include folders for headers and libraries. It can also contain additional information such as vendor information and capabilities. Add helloworld.mmp to each workspace folder:

helloworld.mmp (4 lines)
  1. TARGET helloworld.app
  2. TARGETTYPE app
  3. TARGETPATH \system\apps\helloworld
  4. UID 0x100039CE 0x10205D9D

Since Symbian 9, the target type has been changed from .app to .exe. When building with these SDKs, change helloworld.app into helloworld.exe. Change TARGETTYPE to exe as well. Also remove targetpath and add EPOCSTACKSIZE 0x8000.

The UID is a unique number to identify your application. The first UID (0x100039CE) is a generic Symbian UID and will always be the same. The second UID (0x10205D9D) will be different for each application. In this sample we use the generic EDGELIB UID. For more information about UID's, check the application UID chapter. For Symbian 9, also change the UID from 0x10205D9D into 0xF0205D9D.

Now append helloworld.mmp with a macro definition to pass to the compiler. It is needed to identify the Symbian target platform. Add MACRO xxx where xxx will be one of the following: SERIES60, SERIES80, SERIES90 or SYMBIANUIQ. Also specify the application UID as a macro. Add MACRO APP_UID=0x10205D9D or MACRO APP_UID=0xF0205D9D depending on the Symbian SDK.

Finally add the c++ source files, header paths and libraries to the project file:

helloworld.mmp (32 lines)
  1. SOURCEPATH .
  2. SOURCE ..\code\helloworld.cpp
  3.  
  4. USERINCLUDE .
  5. USERINCLUDE ..\code
  6. USERINCLUDE ..\..\edge\include
  7.  
  8. SYSTEMINCLUDE \epoc32\include
  9. SYSTEMINCLUDE \epoc32\include\libc
  10.  
  11. STATICLIBRARY edge.lib
  12. STATICLIBRARY edgerender.lib
  13.  
  14. LIBRARY euser.lib
  15. LIBRARY apparc.lib
  16. LIBRARY cone.lib
  17. LIBRARY eikcore.lib
  18. LIBRARY eikcoctl.lib
  19. LIBRARY ws32.lib
  20. LIBRARY efsrv.lib
  21. LIBRARY etel.lib
  22. LIBRARY apgrfx.lib
  23. LIBRARY fbscli.lib
  24. LIBRARY bitgdi.lib
  25. LIBRARY esock.lib
  26. LIBRARY insock.lib
  27. LIBRARY bluetooth.lib
  28. LIBRARY btextnotifiers.lib
  29. LIBRARY btmanclient.lib
  30. LIBRARY sdpagent.lib
  31. LIBRARY sdpdatabase.lib
  32. LIBRARY hal.lib

A few libraries need to be added depending on the Symbian SDK:
STATICLIBRARY zlib.lib (All SDKs except Symbian 9+)
LIBRARY estlib.lib (All device builds)
LIBRARY avkon.lib (All S60 SDKs)
LIBRARY qikctl.lib (UIQ 2.1)
LIBRARY qikcore.lib (UIQ 3.0)
LIBRARY quiconfigclient.lib (UIQ 3.0)
LIBRARY etel3rdparty.lib (Symbian 8+ SDKs, Series 90)
LIBRARY ezlib.lib (Symbian 9+ SDKs)
LIBRARY plpvariant.lib (S60 except S60 3rd edition, Series 80, UIQ 2.1)

For Symbian 9+ builds you also need to specify a language code, vendor ID and application capabilities. Add the following code to helloworld.mmp:

helloworld.mmp (4 lines)
  1. LANG SC
  2.  
  3. VENDORID      0
  4. CAPABILITY    NONE

The language code SC is undefined and will be used by default. When not using a vendor ID, it will be set to 0. Read the security chapter for more information about capabilities. When using capabilities they can be specified as: CAPABILITY LocalServices NetworkServices

Resources

Each Symbian application requires at least one resource file, otherwise it won't be able to start. For devices before Symbian 9 create this resource file:

helloworld.rss (10 lines)
  1. NAME HEWO
  2.  
  3. #include <eikon.rh>
  4. #include <eikcore.rsg>
  5.  
  6. RESOURCE RSS_SIGNATURE { }
  7.  
  8. RESOURCE TBUF { buf=""; }
  9.  
  10. RESOURCE EIK_APP_INFO{ }

For devices with Symbian 9 and later create 2 resource files:

helloworld.rss (20 lines)
  1. NAME HEWO
  2.  
  3. #include <eikon.rh>
  4. #include <appinfo.rh>
  5.  
  6. RESOURCE RSS_SIGNATURE { }
  7.  
  8. RESOURCE TBUF { buf=""; }
  9.  
  10. RESOURCE EIK_APP_INFO{ }
  11.  
  12. RESOURCE LOCALISABLE_APP_INFO exe_localisable_app_info
  13. {
  14.     short_caption = "Helloworld";
  15.     caption_and_icon = CAPTION_AND_ICON_INFO
  16.     {
  17.         caption = "Helloworld";
  18.         number_of_icons = 0;
  19.     };
  20. }
helloworld_reg.rss (14 lines)
  1. #include <AppInfo.rh>
  2. #include <helloworld.rsg>
  3.  
  4. UID2 KUidAppRegistrationResourceFile
  5. UID3 0xF0205D9D
  6.  
  7. RESOURCE APP_REGISTRATION_INFO
  8. {
  9.     app_file = "helloworld";
  10.     localisable_resource_file = "\\resource\\apps\\helloworld";
  11.     localisable_resource_id = EXE_LOCALISABLE_APP_INFO;
  12.     embeddability=KAppNotEmbeddable;
  13.     newfile=KAppDoesNotSupportNewFile;
  14. }

Resources also need to be added to the helloworld.mmp project file. When targetting Symbian 9+ you need to add the following section:

helloworld.mmp (12 lines)
  1. START RESOURCE helloworld.rss
  2. HEADER
  3. TARGETPATH    \resource\apps
  4. END
  5.  
  6. START RESOURCE helloworld_reg.rss
  7. #ifdef WINSCW
  8. TARGETPATH    \private\10003a3f\apps
  9. #else
  10. TARGETPATH    \private\10003a3f\import\apps
  11. #endif
  12. END

For other builds you can add one line of code: RESOURCE helloworld.rss.

Creating icons

Create a new folder C:\projects\helloworld\res\aif. This folder contains additional resources for this application. Create two icon bitmap files inside this folder: icon.bmp and iconmask.bmp. The first one contains the icon itself, the second contains an alpha mask to blend the icon with (white has no opacity, black has full opacity). The recommended icon size depends on the target platform. For Series 60 we recommend an icon of 24x24 pixels, for Series 80 and Series 90 we recommend 25x20 or 64x50 and for UIQ we recommend an icon of 20x20 pixels. Read below on how to attach an icon to your application.

AIF resource (before Symbian 9)

It's possible to add resource information, such as the program title and an icon. Before Symbian 9 an .aif resource file is used. To create the .aif file include a new line of code at the bottom of helloworld.mmp:
AIF helloworld.aif ..\res\aif aif.rss c12 icon.bmp iconmask.bmp

Add this file to the C:\projects\helloworld\res\aif folder:

aif.rss (11 lines)
  1. #include <aiftool.rh>
  2.  
  3. RESOURCE AIF_DATA
  4. {
  5.     app_uid = 0x10205D9D;
  6.     caption_list=
  7.     {
  8.         CAPTION { code = ELangOther; caption = "Hello World"; }
  9.     };
  10.     num_icons = 1;
  11. }

Adding icons (Symbian 9+)

For Symbian 9+ expand the following section in helloworld.rss:

helloworld.rss (10 lines)
  1. RESOURCE LOCALISABLE_APP_INFO exe_localisable_app_info
  2. {
  3.     short_caption = "Helloworld";
  4.     caption_and_icon = CAPTION_AND_ICON_INFO
  5.     {
  6.         caption = "Helloworld";
  7.         number_of_icons = 1;
  8.         icon_file = "\\resource\\apps\\helloworld_aif.mbm";
  9.     };
  10. }

Then create an .mbm file with the following command: bmconv helloworld_aif.mbm /c12..\res\aif\icon.bmp /c12..\res\aif\iconmask.bmp.

Creating a batchfile

To ease the building process, we will create a batch file. It should contain the following:

build.bat (10 lines)
  1. set OLDPATH=%PATH%
  2. set OLDEPOC=%EPOCROOT%
  3. set PATH=%symbianroot%\6.1\Shared\EPOC32\gcc\bin\;%symbianroot%\6.1\Shared\Epoc32\Tools\;%symbianroot%\6.1\Series60\Epoc32\Tools\;%path%;C:\Program Files\Microsoft Visual Studio\VC98\Bin;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
  4. set EPOCROOT=\Symbian\6.1\Series60\
  5. devices -setdefault @Series60_1_2_CW:com.Nokia.Series60_1_2_CW
  6. call bldmake bldfiles
  7. call abld build armi urel
  8. makesis %1.pkg
  9. set PATH=%OLDPATH%
  10. set EPOCROOT=%OLDEPOC%

Set path and epocroot is only needed for the Series 60 and Series 80 first edition SDKs. These can be removed for all other SDKs.

Devices is used to change the active Symbian SDK. Get a list with the following command: devices.

call bldmake bldfiles prepares the building process and call abld build armi urel compiles the program. When targetting Symbian 9.1 you need to call call abld build gcce urel and for emulator builds call call abld build winscw udeb.

Makesis reads the package file and creates helloworld.sis. Read the Symbian installation chapter for more information.

The batchfile can be executed from the commandline with this command: call build helloworld. Make sure that the current folder is the same as the batchfile before executing this command.

Chapters

Latest forum posts