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 12-May-2006, 17:41
bharat suthar bharat suthar is offline
New Member
 
Join Date: May 2006
Posts: 2
bharat suthar is on a distinguished road

about undefined reference for 'sinf'


I m writting code in c using another library(parapin) and making Makefile .but there is a error like
undefined reference to `sinf'
undefined reference to `ceilf'
although i have added math.h library in my code
. I tried to run simple programme using math.h
and it run.but in making Makefile it is giving me error
  #2  
Old 12-May-2006, 18:13
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,243
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: about undefined reference for 'sinf'


That's because there is no sinf() and ceilf() in standard C -- and obviously not in your compiler.

If the functions are in the parapin library, you have to link it during your compile/build.

Please don't forget to read the Guidelines so we can help you to the best of our ability. Without the guidelines, we will probably have to ask more questions to get enough info, which will waste a lot of time. #1 thru #4 are the most important.
__________________

Age is unimportant -- except in cheese
  #3  
Old 12-May-2006, 18:17
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,712
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: about undefined reference for 'sinf'


Quote:
Originally Posted by bharat suthar
I m writting code in c using another library(parapin) and making Makefile .but there is a error like
undefined reference to `sinf'
undefined reference to `ceilf'
although i have added math.h library in my code
. I tried to run simple programme using math.h
and it run.but in making Makefile it is giving me error

1. Post the code and the Makefile.
2. Tell us exactly what the error is. (Paste the message into your post; don't paraphrase.)
3. Tell us what compiler you are using.

The functions sinf(), cosf(), ceilf(), etc. are part of the C99 Standard library, but not C89 or C++ standard libraries. Some compilers may support them; some do not. If you have source code, you can replace sinf() with sin(), ceilf() with ceil(), etc. Or, if this is a linker error using object or library files from other sources, you can make your own versions of the xxxf() functions and link them in.

There may be compiler command line switches that let you include such things (or, maybe, not).

Regards,

Dave
  #4  
Old 12-May-2006, 19:05
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,243
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: about undefined reference for 'sinf'


Quote:
Originally Posted by davekw7x
1. Post the code and the Makefile.
2. Tell us exactly what the error is. (Paste the message into your post; don't paraphrase.)
3. Tell us what compiler you are using.
That's what I said

Quote:
Originally Posted by davekw7x
The functions sinf(), cosf(), ceilf(), etc. are part of the C99 Standard library, but not C89 or C++ standard libraries.
Ahhh, thanks for this info Dave, I didn't know that. Guess I haven't found a good C99 reference yet.
__________________

Age is unimportant -- except in cheese
  #5  
Old 12-May-2006, 19:37
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,712
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: about undefined reference for 'sinf'


Quote:
Originally Posted by WaltP
That's what I said


Ahhh, thanks for this info Dave, I didn't know that. Guess I haven't found a good C99 reference yet.

Of course the problem is that if someone didn't know sinf() is a C99 Standard library function he/she might not even think of looking in the "new" <math.h>. Borland and Microsoft users: fuggadaboudit. GNU users: check the GNU documentation about library functions.

General resources for the casual reader abound:

dinkumware is a good resource

delorie is another good one


Regards,

Dave
 
 

Recent GIDBlogObservations of Iraq 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
[Linker error] undefined reference to `WinMain@16' vermin1302 C++ Forum 4 24-Feb-2006 09:39
c++ inheritance illbemissingu C++ Forum 14 23-Oct-2005 17:35
Undefined reference to 'GetDefaultPrinterA' joergf C++ Forum 3 06-Oct-2005 14:00
Linker Errors with Dev-C++ 5 Gamer_2k4 C++ Forum 1 18-Apr-2005 11:08
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 07:10

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

All times are GMT -6. The time now is 11:31.


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