<p>When attempting to call functions in <code>math.h</code>, I'm getting link errors like the following  </p>

<pre><code>undefined reference to sqrt
</code></pre>

<p>But I'm doing a <code>#include &lt;math.h&gt;</code><br>
I'm using gcc and compiling as follows:</p>

<pre><code>gcc -Wall -D_GNU_SOURCE blah.c -o blah
</code></pre>

<p>Why can't the linker find the definition for <code>sqrt</code>?</p>

You need to link the math library explicitly. Add
```
-lm
```
to the flags you're passing to gcc so that the linker knows to link
```
libm.a
```