Is there a way I can create a round function in C?

Viewed 50

I am fairly new to coding and cannot find help anywhere, although my code works perfectly on several compilers. I am trying to round my numbers in my code and am advised to use the functions round() or ceil() in the <math.h> library. However with this library I constantly get errors. When looking online for help I constantly get put back to square one with just use the round(), ceil() function in <math.h> to round. However, when trying to submit my code through a matrix server all is well when using this command; 'gcc -lm testing.c -o check' it compiles and executes properly. However with this command 'gcc -Wall testing.c -o check' it does not compile and gives me an error for both round() and ceil() functions.

NOTE: I am unable to change this command as it is hard coded to submission and with only this command I am allowed to submit

Both errors (with either function from <math.h> library); undefined reference to 'ceil' or undefined reference to 'round'

Is there a way to define this reference besides using the <math.h> library?

If not, I wanted to know if this is at all possible to create a rounding function in C without using the rounding() or ceil() functions or <math.h> library along without any other use of libraries? Is there a hard-coded round function in the Linux manual that I missed? Thanks in advance!

0 Answers
Related