Preparing, compiling, and linking a C/C++ project

This task is part of the larger task of Developing DB2 Everyplace applications using C/C++. When you complete the steps for Preparing, compiling, and linking a C/C++ project, return to Developing DB2 Everyplace C/C++ applications.

Procedure

DB2 Everyplace includes header files and operating system library files for application development.

To prepare a project file and compile and link a DB2 Everyplace application using the correct complier:

  1. Create a project file. This procedure varies depending on the development tools and operating system that you are developing for.
  2. Include the following DB2 Everyplace header files in the project. The header files contain the constants, data types, and C/C++ function prototypes provided with DB2 Everyplace. The header files are:
    \db2everyplace\Clients\include\sqlcli.h
    \db2everyplace\Clients\include\sqlcli1.h
    \db2everyplace\Clients\include\sqlext.h
    \db2everyplace\Clients\include\sqlsystm.h
    
  3. Include any header files specific to you application.
  4. Include the appropriate DB2 Everyplace library in the project.

    The following table summarizes the DB2 Everyplace libraries and lists additional information for each operating system.

    Table 3. DB2 Everyplace libraries

    Operating system Required library files and additional information
    Palm OS \db2everyplace\clients\palmos\database\DB2e.lib Optional: Increase the stack size to 8 KB. The default is 4 KB.

    Palm OS applications have a limited default application stack size. Depending on the application, you may encounter a stack overflow problem at run time. To avoid this problem, specify a larger stack size in the palm-pref.r file that is included with DB2 Everyplace. Follow the instructions in the palm-pref.r file and include it in the project file.

    If you are developing an application using PRC-Tools, add stack=0x8000 in the .def file for your application. For example: application {"MyApplicationName" APID stack=0x8000 }

    Symbian OS v6

    Emulator applications: \db2everyplace\clients\symbian6\database\wins\DB2e.lib

    Device applications: \db2everyplace\clients\symbian6\database\armi\DB2e.lib

    Symbian OS v7

    Emulator applications: \db2everyplace\clients\Symbian7\database\wins\DB2e.lib

    Device applications: \db2everyplace\clients\Symbian7\database\armi\DB2e.lib

    Windows CE

    ARM processor:

    • V3.00 \db2everyplace\clients\wince\database\wce300\armrel\DB2e.lib
    • V4.00 \db2everyplace\clients\wince\database\wce400\ARM4VRel\DB2e.lib

    MIPS processor:

    • V3.00 \db2everyplace\clients\wince\database\wce300\mipsrel\DB2e.lib
    • V4.00 \db2everyplace\clients\wince\database\wce400\MIPSIVRel\DB2e.lib

    SH3 processor:

    • V3.00 \db2everyplace\clients\wince\database\wce300\sh3rel\DB2e.lib
    • V4.00 \db2everyplace\clients\wince\database\wce400\SH3Rel\DB2e.lib

    Windows CE emulator:

    • V3.00 \db2everyplace\clients\wince\database\wce300\x86emrel\DB2e.lib (for Pocket PC emulator) \db2everyplace\clients\wince\database\wce300\x86rel\DB2e.lib (for Pocket PC 2002 emulator)
    • V4.00 \db2everyplace\clients\wince\database\wce400\emulatorRel\DB2e.lib (for WinCE.NET emulator)

    Verify that UNICODE is enabled for the project. Add UNICODE and _UNICODE to the Preprocessor Definition of the Project Settings.

    XScale processor:

    • v3.00 \db2everyplace\clients\wince\database\wce300\xscale\DB2e.lib

    Win32 \db2everyplace\clients\Win32\database\x86\DB2e.lib
    Neutrino libdb2e.so

    This file is located in the \db2everyplace\clients\neutrino\database\proc\ directory.

    Linux libdb2e.so

    This file is located in the /db2everyplace/Clients/Linux/database/proc directory.

  5. Optional: Define the macro UNICODE and _UNICODE in your project file to get UNICODE support.
  6. Compile the project and link the object code with the appropriate DB2 Everyplace library.

    Many of the application development tools provide automatic compiling and linking from within a integrated development environment. For additional information on compiling and linking a project, see the documentation included with your application development software.

Related concepts

Related tasks

Related reference