title: Using GSL on Windows (compiling, linking, ect). A Step by Step Guide
body: <p>I need to write some C code using GSL (GNU Scientific Library), and have never used libraries before.</p>
  <p>I am a Physicist, not a computer scientist, and struggle with a lot of the jargon in the GNU documentation.</p>
  <p>For the last few hours I've been thoroughly confused on how to use GSL on a Windows 7 machine. I've tried reading a lot of questions on this site as well as others, but a lot of the jargon goes over my head.</p>
  <p>Normally, when I write a program I do the following steps:</p>
  <ol>
  <li><p>Open notepad++, include any of my own header files and write my code.</p>
  </li>
  <li><p>Compile my program by opening the Windows Command prompt and typing:</p>
  </li>
  </ol>
  <p><code>gcc -Wall -std=c99 -o myfile myfile.c</code></p>
  <p>I made gcc an Environment Variable, and installed gcc by installing CodeBlocks for Windows (however, I don't use codeblocks).</p>
  <p><strong>HOW TO INSTALL GSL:</strong></p>
  <ol>
  <li><p>Downloaded GSL for Windows from: <a href="http://gnuwin32.sourceforge.net/packages/gsl.htm" rel="nofollow noreferrer">http://gnuwin32.sourceforge.net/packages/gsl.htm</a></p>
  </li>
  <li><p>Installed it on the Desktop, so that my Path will have no space characters (I've read spaces in the Path can be a problem).</p>
  </li>
  <li><p>Set my Path Environment Variable to the location of the .dll's: <code>C:\Users\Rohan\Desktop\GnuWin32\bin;</code></p>
  </li>
  <li><p>Attempted to compile the GSL example program:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;gsl/gsl_sf_bessel.h&gt;
  
  int main (void)
  {
    double x = 5.0;
    double y = gsl_sf_bessel_J0 (x);
    printf (&quot;J0(%g) = %.18e\n&quot;, x, y);
    return 0;
  }
  </code></pre>
  </li>
  </ol>
  <p>5.I called the compiler as follows:</p>
  <pre><code>C:\Users\Rohan\Desktop&gt;gcc -Wall -I&quot;C:\Users\Rohan\Desktop\GnuWin32\include&quot; -L&quot;C:\Users\Rohan\Desktop\GnuWin32\lib&quot; -lgslcblas -lgsl -lm -o test test.c
  </code></pre>
  <p>This resulted in the following error message:</p>
  <pre><code>C:\Users\Rohan\AppData\Local\Temp\ccW8cO7I.o:test.c:(.text+0x30): undefined reference to `gsl_sf_bessel_J0'
  collect2: ld returned 1 exit status
  </code></pre>
  <p>Most of this was done with little understanding, due to not having a background in CS.</p>
  <p>Am I even on the right track? Is there an easy step by step guide, in non-technical language I can follow to get this working?</p>
  <p>Any help would be greatly appreciated,
  Thanks!</p>