Today I learned how to make library, it is very simple I had added add and subtract function to my library for creating library we basically need to have 3 files :
1) header file : Where the class and the constructor is declared
2).cpp file: In this file constructors are defined
3)main.cpp: In this file you can use the function added in the library
Steps to make shared library:
1) g++ -c -Wall -Werror -fpic add.cpp
2)g++ -shared -o libarithm.so add.o
3)g++ /home/manmeet/Desktop/ma
manmeet.html~ math _lib/
4)g++ -L/home/manmeet/Desktop/math\ _lib/ -Wall -o prog main.cpp -larithm
5)export LD_LIBRARY_PATH=/home/manmeet/Desktop/math\ _lib/:$LD_LIBRARY_PATH
6)./prog
Recent Comments