title: GNU Scientific Library MACOS Monterey Compilation
body: <p>I work on macOS Monterey with an M1 chip, and I want to use the GSL Library in my algorithms. However, I never use other libraries except for stdio.h, stdlib.h and math.h. I do have not so much experience in C (or informatics in general), and I have no idea how to fix my problems.</p>
  <p>I install GSL with Homebrew, and it is correctly installed in /opt/Homebrew/Cellar/.</p>
  <p>In my program I include the libraries with this line :</p>
  <pre><code>#include &lt;gsl/gsl_statistics.h&gt;
  </code></pre>
  <p>When I try to compile my program with the GSL libraries in the Terminal, the libraries are not found if I only use the simple command:
  <code>gcc -o PROG myprogam.c</code>.</p>
  <p>I know that I should mention where the libraries are in with the following command:</p>
  <pre><code>gcc -Wall -I/opt/homebrew/Cellar/gsl/2.7.1/include/gsl -c myprogram.c
  </code></pre>
  <p>After this, it seems that (according to the GNU tutorial) I should link the program to the libraries by using the following command :</p>
  <pre><code>gcc -L/opt/homebrew/Cellar/gsl/2.7.1/lib myprogram.o -lgsl -lgslcblas -lm
  </code></pre>
  <p>Now I have three questions:</p>
  <ol>
  <li>What are all these &quot;commands&quot; (-Wall, -I, -c, -L, -lgsl, -lm,...)?</li>
  <li>I saw that I could use a &quot;shortcut&quot; (a Makefile ??) to implement all these commands in my code. I don't understand how it works, and I think it could be a good option.</li>
  <li>Is it possible to put all the libraries in a directory where they could be directly recognizable by the compiler (for example, I do not have to specify where stdio.h is. Is it possible to do the same with the GSL Libraries ?)</li>
  </ol>
  <p>Thank you in advance, and my apologies for any potentially stupid questions I might have asked... As I said, IT is not my field at all, but I use it daily for my thesis.</p>
  <p>Sincerely yours.</p>