You are here

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

Last Updated: October 08, 2014
Version: 
**
Question: 

How do you use math functions in PSoC® Creator™ 3.0 for the PSoC 4 or PSoC 5LP GCC Compiler?

Answer: 

To use math functions (for example, sqrt or pow) with PSoC Creator, do the following steps:

  1. Click Project.
  2. Click Build Settings.
  3. Open the Linker settings under ARM GCC 4.7.3 and click General.
  4. Under Additional Libraries, add m.

These steps are shown in Figure 1.

Figure 1. Adding the Math Library

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.

Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type