Linking with CreaLibs


Compiling C files

Creating your on program using CreaLibs is a simple process. First include whathever header file you need and compile your code setting the -I option. For instance, the compression.cxx file contains:

#include <creaImage/Image.hxx>
int main(int argc, char **argv) {
  Image<short> input(argv[1]);
  ...
}
and compiles as:
g++ compression.cxx -Wall -Icrea/libs -c
where crea/libs is the directory containing include files.

Linking with dynamic libraries

Second link your objects file with the dynamic library libcreaImage.so. For instance:

g++ compression.o -o compression -Lcrea/libs -lcreaImage
where crea/libs is the directory containing the libraries.

At execution time, the dynamic library is loaded by your executable program. To ensure that the dynamic library is found, set your LD_LIBRARY_PATH to a proper value:

setenv LD_LIBRARY_PATH ${HOME}/crea/lib:${LD_LIBRARY_PATH}
or
export LD_LIBRARY_PATH=${HOME}/crea/lib:${LD_LIBRARY_PATH}
Alternatively it is possible to link your program with a hard reference on the dynamic library directory using the proper linker option. Under linux, this is:
g++ compression.o -o compression -L${HOME}/crea/lib -lcreaImage -Wl,-rpath,${HOME}/crea/lib/linux

Linking with graphic libraries

When using the wxWindow libraries to create a graphic interface, you should add some libraries to your compile commands. Refer the the viewer overview page for these commands.