Yes, ignoring stuff like inline functions defined in headers, standard UNIX-like expectations would be for the header math.h to contain a function *prototype* that *declares* floor.<div><br></div><div>The library contains the compiled floor function *definition* as executable code for your architecture.  The source for the definition is part of glibc, probably a function body *defined* in a .c file.</div>
<div><br></div><div>Both the source and the compiled form of the function can be thought of as the implementation in different forms.  The declaration in the header is information that the compiler can use to make sure that the types of the function parameters and of the return value are right.  You can think of the header stuff as &quot;interface&quot; as opposed to &quot;implementation&quot;, but the C language and runtime aren&#39;t essentially modular, so you&#39;ll exhaust the usefulness of that metaphor if you go very deep.</div>
<div><br></div><div>Usually the specific difference is the compiler option Sparr mentions.  You can see that on the CentOS 6 system I&#39;m using, the option isn&#39;t required:</div><div><br></div><div><div>[ecashin@marino ~]$ cat &gt; t.c</div>
<div>#include &lt;math.h&gt;</div><div>#include &lt;stdio.h&gt;</div><div><br></div><div>int main(void)</div><div>{</div><div>        printf(&quot;%g\n&quot;, floor(2.3));</div><div>        return 0;</div><div>}</div><div>
[ecashin@marino ~]$ gcc -Wall t.c</div><div>[ecashin@marino ~]$ ./a.out </div><div>2</div><div>[ecashin@marino ~]$ gcc -Wall t.c -lm</div><div>[ecashin@marino ~]$ ./a.out </div><div>2</div><div>[ecashin@marino ~]$ </div></div>
<div><br><br><div class="gmail_quote">On Wed, Jun 19, 2013 at 10:54 AM, Sparr <span dir="ltr">&lt;<a href="mailto:sparr0@gmail.com" target="_blank">sparr0@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">math.h only declares the function. The implementation is in /var/lib/libm (math lib). You need to tell the compiler to link to that with -lm </p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Jun 19, 2013 10:52 AM, &quot;leam hall&quot; &lt;<a href="mailto:leamhall@gmail.com" target="_blank">leamhall@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div>Morning Ed!<br><br>I&#39;m looking around (googling) to understand what you mean and I&#39;m not getting it. math.h is included in the program and exists in /usr/include. <br><br></div>Leam<br><br><div class="gmail_extra">


<br><br><div class="gmail_quote">On Wed, Jun 19, 2013 at 10:30 AM, Ed Cashin <span dir="ltr">&lt;<a href="mailto:ecashin@noserose.net" target="_blank">ecashin@noserose.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Maybe link the math library?  A quick check suggests that&#39;s it.<div><br></div><div><div>[ecashin@marino ~]$ man floor | grep Link</div><div>       Link with -lm.</div><div>[ecashin@marino ~]$ </div><br><div class="gmail_quote">


<div><div>
On Wed, Jun 19, 2013 at 10:18 AM, leam hall <span dir="ltr">&lt;<a href="mailto:leamhall@gmail.com" target="_blank">leamhall@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div>
<div dir="ltr"><div><div>Not sure why I&#39;m getting:<br><br></div>gcc -Wall -Werror -o rand rand.c<br>/tmp/ccAJ7e8S.o: In function `main&#39;:<br>rand.c:(.text+0x16): undefined reference to `floor&#39;<br>collect2: ld returned 1 exit status<br>




 <br>###<br></div>rand.c<br>###<br clear="all"><div><div><div><br>#include &lt;stdio.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;math.h&gt;<br><br>int main(void) {<br><br>    int num;<br>




    float val = 2.3;<br>    num = floor(val);<br>    printf(&quot;num is %d.\n&quot;, num);<br><br>    return 0;<br>}<span><font color="#888888"><br><br>-- <br><div><a href="http://leamhall.blogspot.com/" target="_blank">Mind on a Mission</a></div>




</font></span></div></div></div></div>
<br></div></div>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><span></span><br></div></blockquote></div><br clear="all"><br>-- <br><div><a href="http://leamhall.blogspot.com/" target="_blank">Mind on a Mission</a></div>
</div></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div>
</div></div><br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>  Ed Cashin &lt;<a href="mailto:ecashin@noserose.net">ecashin@noserose.net</a>&gt;<br>  <a href="http://noserose.net/e/">http://noserose.net/e/</a><br>  <a href="http://www.coraid.com/">http://www.coraid.com/</a>
</div>