I am trying to compile a bunch of different object files into an executable file using this command:
gcc -Wall -Ilib -lm -Itest/lib -o test/test_passwd test/test_cases/test_passwd.c build/tests/hills_quad_two.o build/tests/hills_blank_quad.o build/tests/climber.o build/tests/hills_double.o build/tests/hills_multi_var.o build/tests/test.o build/tests/hills_sin.o build/tests/hills_exp.o
and I am getting two errors:
/usr/bin/ld: build/tests/hills_sin.o: in function `hills_sin_function':
hills_sin.c:(.text+0x100): undefined reference to `sin'
/usr/bin/ld: hills_sin.c:(.text+0x11f): undefined reference to `sin'
/usr/bin/ld: build/tests/hills_exp.o: in function `hills_exp_function':
hills_exp.c:(.text+0x122): undefined reference to `exp'
/usr/bin/ld: hills_exp.c:(.text+0x1a0): undefined reference to `exp'
collect2: error: ld returned 1 exit status
I have linked the math library using -lm in the compilation command as well as using #include <math.h>
in a header file. I'm not sure what I'm doing wrong that stops it from compiling. Thanks in advance for the help.