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
Why can arithmetic operations not be performed on void pointers?
what are the different storage classes in c?
What is meant by preprocessor in c?
When should the const modifier be used?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
How can you draw circles in C?
write a program to print largest number of each row of a 2D array
What is a macro?
What is the difference between memcpy and memmove?
What are pointers? What are different types of pointers?
Why doesnt this code work?
What is a structural principle?
What are the application of void data type in c?
Describe the order of precedence with regards to operators in C.
Give the rules for variable declaration?