GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Jul-2005, 03:57
tnethaji tnethaji is offline
New Member
 
Join Date: Jul 2005
Posts: 3
tnethaji is on a distinguished road

C math functions


Hi any help appreciated.

I face this problem in redhat linux 9.0 C compilers. I have put a sample C program here.

CPP / C++ / C Code:
#include "math.h"
main()
{
 float x,y;

 for(x=1;x<=5;x++)
    printf("x = %.2f\n",log(x));
}

the error after compiling
CPP / C++ / C Code:
% cc mathfn.c

CPP / C++ / C Code:
/tmp/ccKEOPS2.o(.text+0x3c): In function `main':
: undefined reference to `log'
collect2: ld returned 1 exit status

thanks
  #2  
Old 04-Jul-2005, 06:03
tnethaji tnethaji is offline
New Member
 
Join Date: Jul 2005
Posts: 3
tnethaji is on a distinguished road

Got it to work


jus recollected while looking at the compile options to include
CPP / C++ / C Code:
 cc mathfn.c -lm
 
 

Recent GIDBlogHalfway done! by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
friend functions error CaptnB C++ Forum 2 12-Jun-2006 13:39
Please help with functions... brookeville C++ Forum 36 05-Nov-2004 00:23
conflict between printf and stdarg.h va functions mirizar C Programming Language 3 12-Jul-2004 08:11
Understanding functions tommy69 C Programming Language 15 15-Mar-2004 17:59

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:47.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.