During compilation I have this error message.
$ clang greedy.c
/tmp/greedy-e7d5e2.o: In function main':
greedy.c:(.text+0x5c): undefined reference to
round'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have included math.h library. I have tried round(), roundf(), float round(float a), float roundf(float a). Same error message for all. Below is piece of my code converting due into cents and rounding.
// Get due
float due;
printf("Amount owed : ");
scanf("%f", &due);
// Convert into cents
int cents;
float a;
a=due*100;
cents = roundf(a);`
`
make
? Or did you manually typeclang [flags]
? If it is the latter you must link themath.h
library with the-lm
flag.