Building a Standard C++ Application or Library

This topic describes the required header files and libraries to compile and link against to build a Standard C++ application or library on a Symbian platform build environment.

You can build a C++ application or library using one of the following target types:

Notes:

  • The required standard C++ header files are available in the ${EPOCROOT}/epoc32/include/stdapis/stlportv5 directory.

  • The standard C++ library name is libstdcppv5.lib.

  • You must specify the system-include path and library name in the .mmp file associated with the C++ application or library.

STD target types

You can develop a C++ application or library using the following STD target types:

  • STDEXE

  • STDDLL

  • STDLIB

These target types enable symbol lookup by name thereby adding the symbol information into the executable.

Note: For more information about STD target types (STDEXE /STDDLL /STDLIB), see the Target Types section.

Example

The following code snippet illustrates the use of the STD target type stdexe:

//writing an stdexe, the mmp file may look like follows
//Start of test_stdexe.mmp
Target             test_stdexe.exe
Targettype        stdexe
Source            test1.cpp
Systeminclude        /epoc32/include/stdapis/stlportv5
Library            libstdcppv5.lib
Capability        all -tcb
//End of test_stdexe.mmp

Other Symbian target types

You can avoid symbol information overhead while developing C++ applications or libraries, by performing the following configurations:

  1. Use the other Symbian target types such as, dll, lib, exe and so on. For more information about other Symbian target types, see Symbian Tools Guide > Building > Symbian Build System (SBSv1) > Build tools reference > MMP file syntax > targettype.

  2. In addition, use the MMP keyword STDCPP.

You may also have to include ${EPOCROOT}/epoc32/include/stdapis explicitly as the standard C headers are required by the standard C++ header. If you are referring to Standard C APIs directly or indirectly, you must specify libc.lib and libpthread.lib in the .mmp file.

Example

The following code snippet illustrates the use of STDCPP MMP keyword and the use of the exe target type:

//test_exe.mmp
Target             test_exe.exe
Targettype        exe
//The STDCPP keyword specifies Standard C++
STDCPP
Source            test2.cpp
Systeminclude        /epoc32/include/stdapis/stlportv5
Systeminclude        /epoc32/include/stdapis
Library            libstdcppv5.lib libc.lib
Staticlibrary        libcrt0.lib
Capability        all -tcb
//End of test_exe.mmp