About function sin() problem

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

cross mob
chwa_1570756
Level 4
Level 4
25 sign-ins 25 replies posted 10 replies posted

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

   

   }

   

}

0 Likes
1 Solution
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

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

View solution in original post

3 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

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

rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

I tried your code and it works with those changes.

0 Likes
chwa_1570756
Level 4
Level 4
25 sign-ins 25 replies posted 10 replies posted

Thanks Bob,it works.

0 Likes