1. Installation and Usage - AparaV/math-functions GitHub Wiki
There are two ways to start using this library
Firstly, download the archive file to your local development environment. It is recommended that you create a sub directory lib inside your project structure and store the file there. So your file structure should look similar to this:
my-project/
lib/
libmathfuncs.a
main.cpp
...
Make sure you have #include "MathFuncsLib.h" in your main.cpp. Now run:
$ g++ -std=c++11 -o main main.cpp -L../my-project/lib -lmathfuncs
$ ./main
This should work without any errors.
For a more advanced usage, you can store the archive file in usr/lib. With that you no longer need to have the libmathfuncs.a file inside your project directory and you can ignore the -L../my-project/lib flag.
You can also download the source and header files, customize the code and create your own archive files. This is probably better on the long run, but is a tad bit more complicated.
Firstly, download the source and header files and store them in your project directory. The structure I'm using here is going to be something similar to this simple structure. But this is only a skeleton (not recommended) and you should modify this to suit your development needs.
my-project/
lib/
...
MathFuncsLib.h
MathFuncsLib.cpp
main.cpp
...
As usual, make sure you have #include "MathFuncsLib.h" in your main.cpp. Now, run:
$ g++ -std=c++11 -c MathFuncsLib.cpp -o mathfuncs
$ ar rvs lib/libmathfuncs.a mathfuncs.o
$ ls -R
mathfuncs.o
MathFuncsLib.h
MathFuncsLib.cpp
main.cpp
./lib
libmathfuncs.a
$ g++ -std=c++11 -o main main.cpp -L../my-project/lib -lmathfuncs
$ ./main
This should work without any errors. You can change the names of the archive file as you wish, but make sure the name starts with lib.