I'm trying to create a static library in C. I'm use gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
My c files is here:
add.c //Addition operation perform sub.c // Subtract operation perform mul.c // Multiply operation perform div.c // Division operation perform And I'm trying to crate static library libabc.a using following command.
ar rcs libabc.a add.c sub.c mul.c div.c And It's successfully created. but when I run executable using ./a.out ./libabc.a, I got following error.
./libabc.a: error adding symbols: Archive has no index; run ranlib to add one collect2: error: ld returned 1 exit status What I doing wrong? please help me.
Thanks in Advance.