Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 25 Nov 2014, 19:16
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
problem with gcc compiler and math functions
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
gemera

Joined: 17 Feb 2012
Posts: 14

PostPosted: Thu 04 Oct 2012, 12:59    Post_subject:  problem with gcc compiler and math functions  

I've compiled tons of c programs in Puppy using Geany and the gcc compiler without any problems.

But for the first time I have used one of the math functions defined in the <math.h> header and get an error which I just can't solve.

Since I am learning c for both Windows and Linux I know the program works in the gcc compiler in Codeblocks for Windows.

Code:


#include <math.h>
#include <stdio.h>

int main(void)
{
      double x,y;

      x = 5;

      y = sqrt(x);

      return 0;
}



the error message is

Code:


/tmp/ccr0Yo3k.o: In function `main':
/root/test.c:11:undefined reference to `sqrt'
collect2: ld returned 1 exit status
make: ***[all] Error 1



btw I can use ANY of the math functions and get the same error.
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1101

PostPosted: Thu 04 Oct 2012, 13:41    Post_subject:  

Hey Gemera

Although I don't know C at all (high time to learn it at last...), but I think this will shed some light on the problem:
https://bbs.archlinux.org/viewtopic.php?id=47461

I've compiled your example with -lm and it seems to be ok...

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send_private_message 
gemera

Joined: 17 Feb 2012
Posts: 14

PostPosted: Thu 04 Oct 2012, 14:13    Post_subject:  

thanks for the heads up sdk.

really appreciated!
Back to top
View user's profile Send_private_message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Thu 04 Oct 2012, 17:52    Post_subject:  

This is with newer gcc i think . Had similar on Puppy Precise .
_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0428s ][ Queries: 11 (0.0028s) ][ GZIP on ]