Skip to content

Installation

cvikupitz edited this page Dec 27, 2020 · 5 revisions

Installing

To install the library, first clone the git repository with:

$ git clone https://github.com/cvikupitz/libcds.git

Navigate to the cloned repository's root folder, then run the following Make commands:

$ make all
$ make install

If you do not have permissions on your machine for make to install the libraries in the default path, you may specify the installation path you want by editing the following macro in the Makefile:

INSTALL_PATH?=/usr/local   # Change this to whatever path you want

Uninstalling

If you want to uninstall the library from your machine, run the uninstall target command as such:

$ make uninstall

Compiling & Linking

To compile and link the library together with your own project, you will need to reference the library name cds with the compiler's -l flag as shown below:

#include <stdlib.h>
#include <libcds/stack.h>

int main() {

    Stack *st;
    (void)stack_new(&st);

    // do some work here...
    destroy_stack(st, NULL);
    return 0;
}
$ gcc -c test.c
$ gcc test.o -o test -lcds