Berkeley DB Reference Guide:
Building Berkeley DB XML for UNIX/POSIX systems

PrevRefNext

Using Berkeley DB XML on UNIX

An application which uses Berkeley DB XML relies on four libraries: Berkeley DB XML, Berkeley DB, Pathan and Xerces C++. When compiling, the include files from these packages must be available, and the libraries must be included when linking the application. The location of the include files and libraries differs between the binary and source code download packages.

When running the application, each of the shared libraries must be located by the dynamic linker, usually controlled by system settings and the LD_LIBRARY_PATH environment variable. See Dynamic shared libraries for more information

Assuming Berkeley DB XML, Berkeley DB, Pathan and Xerces C++ have all been installed in the default locations, a typical command to compile C++ code that uses Berkeley DB XML is:

c++ -c -I/usr/local/include
-I/usr/local/BerkeleyDBXML.1.2/include
-I/usr/local/BerkeleyDB.4.2/include -c myapp.cpp

Then, to link the objects together into an executable, a typical command is:

c++ -o myapp myapp.o -L/usr/local/lib
-L/usr/local/BerkeleyDBXML.1.2/lib
-L/usr/local/BerkeleyDB.4.2/lib -lpathan -lxerces-c
-ldbxml-1.2 -ldb_cxx-4.2

Note the use of -ldb_cxx-4.2 and not -ldb-4.2. Berkeley DB XML uses the Berkeley DB C++ API internally, so the link step will fail if the wrong library is used.


PrevRefNext

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.