[Solved?] Isnan() not supported on Linux when building locally

Hello everyone.

Today I was doing some testing with po-util and encountered a strange error when building one of my ported libraries.

Only on Linux, even though I have #include <math.h>, I get this error about isnan().

In file included from /home/nrobinson/particle/testing/BNO/firmware/main.cpp:1:0:
/home/nrobinson/particle/testing/BNO/firmware/particle-BNO055/particle-BNO055.h: In member function 'void imu::Vector<N>::normalize()':
/home/nrobinson/particle/testing/BNO/firmware/particle-BNO055/particle-BNO055.h:228:22: error: there are no arguments to 'isnan' that depend on a template parameter, so a declaration of 'isnan' must be available [-fpermissive]
         if (isnan(mag) || mag == 0.0)
                      ^
/home/nrobinson/particle/testing/BNO/firmware/particle-BNO055/particle-BNO055.h:228:22: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../build/module.mk:267: recipe for target '../build/target/user/platform-6-m/firmware/main.o' failed
make[2]: *** [../build/target/user/platform-6-m/firmware/main.o] Error 1
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: *** [user] Error 2
../build/recurse.mk:11: recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

On macOS I do not get this error and my library compiles perfectly.

Hey,

I know that @peekay123 is really great at porting libraries, maybe this is something that he would be able to help with.

Kyle

2 Likes

Unfortunately, I work exclusively on windows. Can you try using double quotes instead of <> around math.h. Humor me since I haven’t seen that error before.

3 Likes

Thanks for clarifying that for me! I also believe that @Hypnopompia is familiar with Linux. What are your thoughts on this?

I just switched to double quotes and it works now on Linux and macOS.

2 Likes

Great to hear! Thanks for the suggestion @peekay123!

I just went back to <> and it works again. I can’t reproduce the error I had on Linux previously. :confused:

@nrobinson2000, LOL!! I love spending time chasing ghosts, don’t you!

1 Like

Yeah. No idea why I had this brief error.

1 Like

did you (also) change the #include order?

Didn’t change the order, just changed from <> to double quotes on one line and changed back.

here

to

here

Does the error reappear when you do a make clean first?

The error does not reappear after cleaning. I am on the release/stable branch.