Build error with math.h

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Switten
Level 2
Level 2
25 sign-ins 10 likes given 10 sign-ins

Hello,

I have a strange problem when building the code I found (see link below or added file). So now my problem: I try to use the functions atan2f and sqrt. I know that to use these I have to include "math.h" which I did, but when I build the code the following errors appear:

Build error: undefined reference to `atan2f'
Build error: undefined reference to `sqrt'

Can someone help meor guide me in a derection where I can solve this?

Link:
https://github.com/EmbeddedSam/MPU-6050/tree/master/Examples/4-MPU-6050-PSoC-GetGsWithInterrupt/MPU-...

PS: the code from the link is made for the Psoc 4, but I use the Psoc 5PL and made the necessary adjustments to make it 'work'.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

In creator ->project->build settings->arm_>linker->additional libraries

add "m" to include mlib

 

Happy coding

Bob

View solution in original post

2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

In creator ->project->build settings->arm_>linker->additional libraries

add "m" to include mlib

 

Happy coding

Bob

thx for the solution and quick reply

0 Likes