When I am compiling code using GCC, it is giving two outputs .o and .d file.
While creating library(.a) do I need to add(.d) files also. If yes then how?
No you only need to add the .o file, a static library archive is just a collection of .o files.
The .d file is a makefile fragment for specifying the dependencies used to build the object file, and is only needed when you are compiling the .o file itself.
gccusually gives only one output.o. You agglomerate these withar