Next: , Up: Embedding Serveez   [Contents][Index]


5.1.1 Compiling and linking

When you have installed a version of Serveez passing the configure script the $prefix argument, e.g., ‘./configure --prefix=/usr/local’, you will find the libserveez library in /usr/local/lib and the include headers in /usr/local/include. If you want to compile a C program using the Serveez API and link against the Serveez core library libserveez, which is libserveez.so for Unices and libserveez.dll for Windows systems, you need to tell the compiler and linker where to find the headers and libraries.

Most C compilers you can use will understand the following command line options for this purpose. The ‘-I’ argument specifies the directory of additional include headers, the ‘-L’ argument the direcory to additional libraries and the ‘-l’ argument the library itself to link against.

$ cc test.c -I/usr/local/include -o test -L/usr/local/lib -lserveez

In order to obtain the correct compiler and linker flag you can also run the ‘serveez-config’ script which gets installed with the Serveez package. The ‘serveez-config’ script can be invoked with the following set of option.

-h, --help

Displays the usage information.

-v, --version

Displays installed Serveez version.

-l, --ldflags

Prints the linker flags (libraries to link with including directory information).

-c, --cflags

Prints the compiler flags to compile with.