Skip to content

use <cmath> instead of <math.h> - #10

Open
asakovets wants to merge 1 commit into
JibbSmart:mainfrom
asakovets:main
Open

use <cmath> instead of <math.h>#10
asakovets wants to merge 1 commit into
JibbSmart:mainfrom
asakovets:main

Conversation

@asakovets

Copy link
Copy Markdown

Hi,

I get compilation errors when using GamepadMotion.hpp on macos. Here is the trivial example:

#include "./GamepadMotion.hpp"

int main () {}
~/s/GamepadMotionHelpers (main)> clang++ test.cc -std=c++23
In file included from test.cc:1:
././GamepadMotion.hpp:1174:30: error: no member named 'abs' in namespace 'std'; did
      you mean simply 'abs'?
 1174 |         y = worldYawSign * std::min(std::abs(worldYaw) * yawRelaxFactor, sqrtf(gyroY * gyroY + gy...
      |                                     ^~~~~~~~
      |                                     abs

This also happens on Linux when using clang and libc++: https://godbolt.org/z/3Pe1bYznh

Including <cmath> instead of <math.h> fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant