Using Math Functions in PSoC® Creator™ for the PSoC 4 or PSoC 5LP GCC Compiler – KBA93076 | Cypress Semiconductor
Support & Community
Using Math Functions in PSoC® Creator™ for the PSoC 4 or PSoC 5LP GCC Compiler – KBA93076
How do you use math functions in PSoC® Creator™ 3.0 for the PSoC 4 or PSoC 5LP GCC Compiler?
To use math functions (for example, sqrt or pow) with PSoC Creator, do the following steps:
- Click Project.
- Click Build Settings.
- Open the Linker settings under ARM GCC 4.7.3 and click General.
- Under Additional Libraries, add m.
These steps are shown in Figure 1.
Figure 1. Adding the Math Library
If you do not add this additional library then you will get the build error, "undefined reference to sqrt" (where sqrt is a math function) if you try to use a math function.