title: gcc gives error while using fmod()
body: <p>Sample code for fmod:</p>
  
  <pre><code>#include &lt;stdio.h&gt;    
  #include &lt;math.h&gt;
  
  int main(void)   
  {    
    double x = 0.14527, y = 3.14159;   
    printf("fmod(x, y) = %.6lf\n", fmod(x, y));    
    return 0;    
  }
  </code></pre>
  
  <p>Compiling:</p>
  
  <pre><code>$ gcc main.c -o main
  </code></pre>
  
  <p>I get</p>
  
  <blockquote>
    <p>/tmp/ccztJO01.o: In function `main':</p>
    
    <p>main.c:(.text+0x4d): undefined reference to `fmod'</p>
    
    <p>collect2: ld returned 1 exit status</p>
  </blockquote>
  
  <p>Then I found this in Google:</p>
  
  <pre><code>$ gcc -lm main.c -o main
  </code></pre>
  
  <p>Why should I use <code>-lm</code>, what is it exactly? From where I can get more information about gcc in detail?</p>