Hello World: A minimal console application

This section describes the steps to build the Hello World project on the emulator.

The code in this section has been taken from the Hello example.

This example demonstrates the most basic use of STDLIB. It consists of the single source code file, slhello.c whose sole function, main() calls printf().

The Hello example's project definition file (Hello.mmp) contains the following:

TTARGET		hello.exe
TARGETTYPE	exe
UID      	0
SOURCEPATH	.
SOURCE		slhello.c
SYSTEMINCLUDE	\epoc32\include\libc  \epoc32\include

LIBRARY		estlib.lib euser.lib 
STATICLIBRARY	ecrt0.lib
Note:
  • The import library estlib.lib is the C standard library.
  • The project also links to ecrt0.lib. This file provides the E32Main() entrypoint for a .exe. It also provides other services including command-line parsing, and it calls main().
  • The SYSTEMINCLUDE path specifies \epoc32\include\libc\, which is the location for STDLIB's header files.

For more information on the project specification for a .exe see How to build for an EXE target.

  1. To build Hello for the Emulator, run bldmake from the directory where the bld.inf file is located: bldmake bldfiles This creates the <file>abld.bat</file> batch file.
  2. Use abld to build the project, for instance: abld build wins udeb
  3. To run it, invoke hello.exe
  4. To build Hello for the target machine, invoke bldmake and abld, specifying the appropriate target platform.
  5. To install software on the target device create a .sis file using the Symbian Installation system. See the Application Installation Guide