Finally got library to compile

Finally adjusted everything so that the project can be compiled as a
static or dynamic library that can be included in another project
without causing linking errors.