Using Gecode
Including header files
Deciding which header files must be included when using Gecode is quite straightforward. There are the following header files for inclusion:- gecode/kernel.hh must always be included (the header files below also always include kernel.hh).
- gecode/search.hh must be included, if search engines are used (see for example Search engines).
- gecode/int.hh must be included, if any integer functionality is used (see for example Using finite domain integers and Programming integer actors).
- gecode/set.hh must be included, if any finite set functionality is used (see for example Using finite integer sets and Programming set actors).
- gecode/minimodel.hh must be included, if direct modelling support is used (see for example Direct modelling).
Other functionality is available through a set of header files. For example to access the implementation of particular propagators, a particular header file must be included. The header file to be included is always mentioned in the documentation of the class or function.
Linking libraries
Setting the exact name for a library on a particular platform aside, inclusion of header files basically coincides with against which library must be linked. That is:- If gecode/kernel.hh is included, linking against the kernel library is required.
- If gecode/search.hh is included, linking against the search library is required.
- If gecode/int.hh is included, linking against the integer library is required.
- If gecode/set.hh is included, linking against the set library is required.
- If gecode/minimodel.hh is included, linking against the minimodel library is required.
The functionality in Support algorithms and datastructures and Range and value iterators require no library for linking. Reusing integer or set propagators of course require the integer or set library.
If there is a difference between library and DLL (such as on Windows) linking must be done against the appropriate library and the corresponding DLL must be available for execution (such as in the PATH environment variable).
Library names
Windows with Visual Studio
- Kernel library and DLL: GecodeKernel.lib and GecodeKernel.dll
- Search library and DLL: GecodeSearch.lib and GecodeSearch.dll
- Integer library and DLL: GecodeInt.lib and GecodeInt.dll
- Set library and DLL: GecodeSet.lib and GecodeSet.dll
- Minimodel library and DLL: GecodeMiniModel.lib and GecodeMiniModel.dll
Unix (Linux, MacOS X)
Depending on whether Gecode was compiled as a static or as a dynamic library, different filename suffixes are used on different Unix platforms. All library names follow the following scheme:
- Kernel library: libgecodekernel.<EXT>
- Search library: libgecodesearch.<EXT>
- Integer library: libgecodeint.<EXT>
- Set library: libgecodeset.<EXT>
- Minimodel library: libgecodeminimodel.<EXT>
where <EXT> depends on the library type and platform:
- libgecode[...].a for static libaries on all Unix flavors
- libgecode[...].so for shared libraries on Linux
- libgecode[...].dylib for shared libraries on MacOS X
You can use for example
gcc -L$GPREFIX/lib -lgecodekernel
to link the kernel library, if the libraries are found in $GPREFIX/lib
.