title: How to install/compile SDL2 C code on Linux/Ubuntu
body: <p>I'm currently doing some C programming and I actually want to use the SDL library. I want to build a Small 2D game in C on Linux to sharp my skills a bit.</p>
  
  <p>My issue is I'm not a super <strong>Makefile</strong> user nor library on Linux super user, I just configure things once when on a project and that's it.</p>
  
  <p>So I have some trouble compiling SDL2 programs on UBUNTU 14.04.</p>
  
  <p>I downloaded the latest SDL library from : <a href="http://www.libsdl.org/download-2.0.php" rel="nofollow">http://www.libsdl.org/download-2.0.php</a></p>
  
  <p>Then I installed it with the default step:</p>
  
  <pre><code>./configure
  make
  sudo make install
  </code></pre>
  
  <p>After that I can see that there is something in <strong>/usr/include/SDL2</strong> so I guess it is installed.</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;SDL2/SDL.h&gt;
  
  int main(int argc, char *argv[])
  {
   printf(“SDL test\n”);
      return 0;
  }
  </code></pre>
  
  <p>Because I'm still learning Makefiles and SDL I didn't figure it out to make it.</p>
  
  <p>but I found this Makefile to compile the old SDL not the SDL2</p>
  
  <pre><code>CPP=gcc   
  CFLAGS=-O3 
  LDFLAGS=-lSDL -lSDL_mixer #Linker
  EXEC=test 
  
  all: ${EXEC}
  
  ${EXEC}: ${EXEC}.o
      ${CPP} $(CFLAGS) -o ${EXEC} ${EXEC}.o ${LDFLAGS}
  
  ${EXEC}.o: ${EXEC}.c
      ${CPP} $(CFLAGS) -o ${EXEC}.o -c ${EXEC}.c
  
  
  clean:  
      rm -fr *.o
  
  mrproper: clean
      rm -fr ${EXEC}
  </code></pre>
  
  <p>But this Makefile is not working for me it says that it doesn't know the lSDL_Mixer and other stuff.</p>
  
  <p>How can I build a workable Makefile to compile C program with SDL2 using Makefiles and vim editor.</p>
  
  <p>Thanks in advance for your help</p>