title: Why does gcc report "implicit declaration of function ‘round’"?
body: <p>I have the following C code:</p>
  
  <pre><code>#include &lt;math.h&gt;
  
  int main(int argc, char ** argv)
  {
      double mydouble = 100.0;
      double whatever = round(mydouble);
  
      return (int) whatever;
  }
  </code></pre>
  
  <p>When I compile this, I get the warnings:</p>
  
  <pre><code>round_test.c: In function ‘main’:
  round_test.c:6: warning: implicit declaration of function ‘round’
  round_test.c:6: warning: incompatible implicit declaration of built-in function ‘round’
  </code></pre>
  
  <p>I'm rusty with C, but I thought that the #include  brought a declaration for round() into scope. I've checked my ANSI standard (C99 is the only copy I have) which confirms that the round() function exists in the math.h header. What am I missing here?</p>
  
  <p>Edit: The compiler is GCC 4.3.2 on Ubuntu (intrepid, IIRC). Running gcc -E gives:</p>
  
  <pre><code>$ gcc -E round_test.c | grep round
  # 1 "round_test.c"
  # 1 "round_test.c"
  # 2 "round_test.c" 2
      double whatever = round(mydouble);
  </code></pre>
  
  <p>so the definition obviously isn't being found in the headers.</p>