Mail Archives: djgpp/1996/01/23/09:53:32
On Tue, 23 Jan 1996, Werner Drescher wrote:
> I wrote some own class-functions in C++ and now I want to make a
> libery-file out of them. I have the C++ file *.cc the header-file *.h and
> I want now the *.a file so that I can link it with the -l option.
> How can I do this ?
Compile your file with `gcc -c file.cc', then use the program called `ar',
like this:
ar rvs libmylib.a file.o
You can then link against this library like this:
gcc main.c sub.c -o myprog -lmylib
Note that your library name *must* begin with `lib' for the linker to
find it when you use -l switch.
- Raw text -