I hope someone can help me. I am working through CS50x and am working on Pset1 - greedy. I have been banging my head against the wall for the last hour trying to figure out why I am getting the error
/tmp/greedy-46be96.o: In function `main':
greedy.c:(.text+0x95): undefined reference to `round'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang -o greedy greedy.c -lcs50
float quarter = 0.25;
float dime = 0.10;
float nickel = 0.05;
float penny = 0.01;
printf("How much change is owed?: ");
owed = GetFloat();
} while(owed <= 0);
change = round(owed * 100);
The following should work when you compile:
clang -o greedy greedy.c -lcs50 -lm
This links the math library for the compiler.