Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Math.h functions...why is the compiler/linker drawing a blank?

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Math.h functions...why is the compiler/linker drawing a blank?
Moderator:
JFMD

Post Reply
Follow this topic



Math.h functions...why is the compiler/linker drawing a blank?

porcine_aviator posted on 19 Jun 2012 11:59 PM PST
Top Contributor
58 Forum Posts

Hi all. I'm trying to use a sin() function. I've #included both math.h and stdlib.h, but my code won't build:

"main.c:37: undefined reference to `sin' "

I say won't build, because if I issue a complie command on the main.c code alone, it works just fine. What gives?

 

P.S. Yes, I know the argument and resultant are both doubles, that's not the problem.




Re: Math.h functions...why is the compiler/linker drawing a blank?

porcine_aviator posted on 19 Jun 2012 12:01 AM PST
Top Contributor
58 Forum Posts

BTW If it matters, I'm using a PSoC 5 in the form of a Cy8kit050 dev board.



Re: Math.h functions...why is the compiler/linker drawing a blank?

porcine_aviator posted on 19 Jun 2012 12:15 AM PST
Top Contributor
58 Forum Posts

It gets even more weird...I found that if I manually type in an argument to sin, the compiler takes it, but if I even so much as assign the same number to another double variable, the compiler (ARM gcc 4.4.1) gets angry.

E.g.:

foo = sin(1.234567); => Compiler happy

************************************************

doo = 1.234567;

foo = sin(doo); => Compiler unhappy!

***********************************************

What is up with this?



Re: Math.h functions...why is the compiler/linker drawing a blank?

Bob Marlowe posted on 19 Jun 2012 01:35 PM PST
Top Contributor
1768 Forum Posts

Yes, this should be outlined better, I have suffered from the same error until someone else helped me out. have a look at this http://www.cypress.com/?id=4&rID=42838 and follow the instructions

 

Bob



Re: Math.h functions...why is the compiler/linker drawing a blank?

porcine_aviator posted on 19 Jun 2012 02:38 PM PST
Top Contributor
58 Forum Posts

Bob, I'd buy you a beer if you weren't 3,000 miles away in Der Deutschland. Danke Schoen!!!!!



Re: Math.h functions...why is the compiler/linker drawing a blank?

Bob Marlowe posted on 19 Jun 2012 04:17 PM PST
Top Contributor
1768 Forum Posts

Got you!!!

I am currently in Silicon Valley having visited Cypress. Where are you, where's my beer??? (very broad smile)

Bob



Re: Math.h functions...why is the compiler/linker drawing a blank?

porcine_aviator posted on 20 Jun 2012 11:31 AM PST
Top Contributor
58 Forum Posts

Bob: if you ever visit the Cleveland area, your beer is on me. We in the Midwest have a lot of really good microbreweries. Enjoy sunny Norcal. If you get a chance, visit one of the open space areas to the West of Sunnyvale/SJ. I recommend Pichetti Ranch. It's some beautiful country!



Re: Math.h functions...why is the compiler/linker drawing a blank?

Arther posted on 11 Jul 2012 04:31 AM PST
Member
8 Forum Posts

Thank you bob

As you said cypress should have outlined this well.even cypress should improve it's search algorithm

I had tried to find on this issue on cypress search but all effort went viens.

This post is pointed out by google.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20