Answer Posted / ataraxic
Using ar utility.
Let's say we have lib1.c lib2.c and myprog.c
We want to do a library from lib1.c && lib2.c, and compile
myprog.c with this library afterwards.
The steps are:
Compile
1. gcc -c lib1.c -o lib1.o
2. gcc -c lib2.c -o lib2.o
Create archive named libmy.a
3. ar -rcsv libmy.a lib1.o lib2.o
Compile myprog with newly created lib
4. gcc myprog.c -L. -lmy -o myprog
| Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
What is an auto keyword in c?
What is indirection?
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is the Purpose of 'extern' keyword in a function declaration?
What is the c language function prototype?
How do you list a file’s date and time?
What's the total generic pointer type?
What is a stream in c programming?
Why clrscr is used after variable declaration?
What language is lisp written in?
What is an identifier?
How many types of sorting are there in c?
How many levels of pointers have?
Explain how can you tell whether two strings are the same?
What is the use of #include in c?