You are here

About function sin() problem | Cypress Semiconductor

About function sin() problem

Summary: 3 Replies, Latest post by newmoon002_1570756 on 18 Sep 2016 09:39 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
newmoon002_1570756's picture
User
6 posts

Hello,

Why did PSOC creator say: "Build error: undefined reference to 'sin'" when I compile the code as below,

and I try to set Inline functions true in build settings,but still display the same error.

 

#include <math.h>

int main(void)

   double x=0.5;

   double y;

   for(;;)

   {

      y = sin(x); //Build error: undefined reference to 'sin'

      y = sin(0.5); //this line is available passed

   }

}

user_242978793's picture
User
1100 posts

Make these changes to PSoC Creator

1) Click Project

2) click Build Settings

3) open the Linker Settings under ARM GCC 4.9-2015-q1-update

4) under Additional Libraries add an m

user_242978793's picture
User
1100 posts

I tried your code and it works with those changes.

newmoon002_1570756's picture
User
6 posts

Thanks Bob,it works.

Log in to post new comments.