First download the latest CGP-Library from Download and unzip the file.


The simplest method of using the CGP-Library is to include cgp.c and cgp.h in your build path and compile them along with your own files.  For instance #include “cgp.h” in your own program and then compile your program similar to

$ gcc yourFiles.c cgp.c cgp.h

On windows operating systems the macro NO_DLL must also be #defined at compile time

$ gcc yourFiles.c cgp.c cgp.h -D NO_DLL

If you intend to make us of the support for multiple threads you must also set the openMP compiler flag

$ gcc yourFiles.c cgp.c cgp.h -fopenmp


The standard method of using dynamic libraries is to link against the compiled library.


To compile the shared object (.so) open a terminal in the CGP-Library directory and run

$ make so

Then copy the generated to /usr/lib by running

$ sudo cp /usr/lib

Give the necessary permissions by running

$ sudo chmod 0755 /usr/lib/

Now copy cgp.h to /usr/include by running

$ sudo cp src/cgp.h /usr/include/

Now update the system so it knows about

$ sudo ldconfig

Finally check that CGP-Library has been installed

ldconfig -p | grep libcgp

Once CGP-Library has been installed it can be used by #include <cgp.h> in your project and linking against the using the -lcgp compiler flag.  Similar to

$ gcc yourFiles.c -lcgp


For windows the CGP-Library has been pre-compiled into CGP-Library.dll.  In order to use CGP-Library.dll there are two options 1) place CGP-Library.dll in the same directory as any executables which use the CGP-Library, or 2) place CGP-Library.dll in the standard windows location for dynamic-link library i.e. C:\Windows\System32 for 32bit or C:\Windows\SysWOW64 for 64bit.  Then #include “cgp.h” when compiling any programs which use the CGP-Library.

The current and previous versions of CGP-Library will be available here for download.