I had a problem with the absolute value command in RobotC.
This is what I wrote:
if(abs(vexRT[Ch4]) < 40)
The compiler just said that there was an overload of abs in the code.
I was easily able to make a work around.
But I want to know what I did wrong for the future.
The fix:
if(vexRT[Ch4] < 40 && vexRT[Ch4] > -40)
I just did this:
int foo = abs(vexRT[Ch4]);
as a test, and I got a warning for a deprecated definition, but that was it. Then I did this:
if(abs(vexRT[Ch4]) < 40) {
}
and I didn’t get any warnings.
I copied your original code into RobotC, and I only had to add the curly braces { }, then I didn’t get any warnings either.
I have no idea what caused your issue, but it seems to be a problem with your copy of RobotC.
Which version of ROBOTC?
Yea, that’s because we deprecated abs for float values and replaced it with fabs, however, abs when used with non-float values should not give that error. It only does it the first time the code is compiled, just ignore it, it really doesn’t matter, I will see of we can sort that for V4.53.
I checked abs with both 4.50 and 4.52 and don’t see any problems beyond the unnecessary deprecated warning.