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’t constant values be used to define an array’s initial size?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
What is hashing in c language?
Explain null pointer.
What is pragma in c?
If null and 0 are equivalent as null pointer constants, which should I use?
What is default value of global variable in c?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Can a variable be both const and volatile?
How can type-insensitive macros be created?
What is a sequential access file?
develop algorithms to add polynomials (i) in one variable
Is main a keyword in c?
4. main() { int c=- -2; printf("c=%d",c); }