Its been ages since I did any proper C/C++ so I had to remind myself of a few things, particularly the compilation of libraries. Libraries are really useful as it simplifies multiple use and sharing of components. I'm a Linux person so I'm going to look at this with a Linux hat on. In Linux there are two types; Static libraries (.a) and dynamically linked shared object libraries (.so). Let take a look at static libraries.
Lets create a library, firstly lets define some code, say in a file example1.c:
To create a library you can do:
cc -c example1.c
which compiles the code. Then you need to make the libary:
ar -cvq libexample.a example1.o
(you can of course include other object files here)
Say you call the function in you maincode.c to now compile this do:
cc -o maincode maincode.c libexample.a







