I am writing a bash script with the purpose of creating a static library for C code and creating an executable. The C program itself works fine, the problem I'm having is that when I run my current script I get the following readout in terminal.
This script will create Lab3 executable and static library.
.//liblab3.a(sin.o): In function `funcSin':
sin.c:(.text+0x13): undefined reference to `sin'
collect2: error: ld returned 1 exit status
End of script
I am very new to bash so I am at a loss.
This is my current script.
#!/bin/bash
echo "This script will create Lab3 executable and static library."
#create object files
gcc -c lab3main.c -o lab3main.o
gcc -c sin.c -o sin.o
gcc -c sphere.c -o sphere.o
gcc -c sumFloats.c -o sumFloats.o
gcc -c volCylinder.c -o volCylinder.o
#create static library
ar rcs liblab3.a lab3main.o sin.o sphere.o sumFloats.o volCylinder.o
#statically link & create executable
gcc lab3main.o -L./ -llab3 -o lab3static
echo "End of script"