Building for Windows Embedded Compact 7

Building Berkeley DB for Windows Embedded Compact 7
Changing Build Configuration Type
Troubleshooting Common Build Errors

This page contains general instructions on building Berkeley DB for Windows Embedded Compact 7 platforms using specific compilers.

The build_wince directory in the Berkeley DB distribution contains project files for Microsoft Visual 2008 with the Windows Embedded Compact 7 installed:

Project File Description
Berkeley_DB.sln Visual Studio 2008 solution
*.vcproj Visual Studio 2008 project files

These project files can be used to build Berkeley DB for the Windows Embedded Compact 7 platform.

Building Berkeley DB for Windows Embedded Compact 7

Visual Studio 2008

  1. Install Windows Embedded Compact 7, and add it to target platforms.
  2. Choose File -> Open Project/Solution.... Navigate to the build_wince directory, select Berkeley_DB and click Open. Wait for the project conversion to finish.
  3. Select the desired target platform from the platform drop-down menu.
  4. Build the desired projects.

Build results

The results of your build will be placed in any one of the following Berkeley DB subdirectories, depending on the configuration that you chose:

build_wince\(Platform)\Debug
build_wince\(Platform)\Release
build_wince\(Platform)\Debug_static
build_wince\(Platform)\Release_static

When building your application during development, you must link against libdb_small61sd.lib or against libdb_sql61sd.lib for SQL features. You can also build using a release version of the Berkeley DB libraries and tools, which will be placed in the build_wince\(Platform)\Release_static directory. You must add the build_wince directory to the list of include directories of your application's project, or copy the Berkeley DB include files to a location in your Visual Studio include path.

Changing Build Configuration Type

This section contains information on how to change between a dynamic library (.dll) and static library (.lib). The library projects and their default output and configuration in the Release build is as follows:

Project Default Output Default Configuration
db_small libdb_small61s.lib Static Library
db libdb61s.lib Static Library
db_sql libdb_sql61.dll Dynamic Library

To change a project configuration type in Visual Studio 2008, select a project and do the following:

  1. Choose Project->Properties and navigate to Configuration Properties.
  2. Under Project Defaults, change the Configuration Type to your desired type.

Note: After this change, the output file names change to the Visual Studio 2008 defaults based on the project name.

Troubleshooting Common Build Errors

  1. Compile error at line 146 in stdlib.h

    This is a known bug for the Windows Embedded Compact 7 SDK. A workaround is to change the line 146 in stdlib.h to read:

    __checkReturn __bcount(_Size) void * __cdecl _alloca(__in size_t 
    _Size);
  2. error LNK2019: unresolved external symbol _localtime_s referenced in function _osLocaltime

    This link error is caused by the fact that the Windows Embedded Compact 7 runtime used to link Berkeley DB does not provide the localtime_s() function. A workaround is to add

    HAVE_LOCALTIME_S=0

    to the proprocessor definitions of the db_sql project. This can be done by right click the db_sql project, select Properties->Configuration Properties->C/C++->Preprocessor->Proprocessor Definitions, and append

    HAVE_LOCALTIME_S=0

    at the end of the list.

  3. error LNK1221: a subsystem can't be inferred and must be defined

    This link error happens on Visual Studio 2008, because it cannot understand the subsystem configured for Visual Studio 2005. To fix this error, right click the project reporting this link error, select Properties->Configuration Properties-> Linker->System->SubSystem, and change the value to WindowsCE (/SUBSYSTEM:WINDOWSCE).

  4. warning C4996: 'xxx': This function or variable may be unsafe.

    Used within the Berkeley DB source tree, these functions are actually safe. You can safely ignore these warnings.