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 are the main characteristics of c language describe the structure of ac program?
How can I recover the file name given an open stream or file descriptor?
How can I make it pause before closing the program output window?
What is getch?
Explain what are binary trees?
Write a program to check prime number in c programming?
Why do we use header files in c?
In C programming, what command or code can be used to determine if a number of odd or even?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Describe wild pointers in c?
What will the preprocessor do for a program?
What is the usage of the pointer in c?
What is the purpose of main( ) in c language?
How macro execution is faster than function ?
Write a program to reverse a given number in c?