title: How do I compile and link a library (SDL) with g++ so that I have a standalone program?
body: <p>I'm using MinGW on Windows 7.</p>
  
  <p>Put simply, I want to create a Hello World SDL program (initiate a window or something simple), and compile it so that I have a standalone program that I can distribute without, say, users having to install anything extra (like putting <code>SDL.dll</code> in the Windows folder).</p>
  
  <ul>
  <li>I've downloaded the SDL development library, which is currently
  sitting in <code>c:\SDL</code>. </li>
  <li>In my project folder I've got <code>test.cpp</code> and <code>SDL.dll</code></li>
  </ul>
  
  <p>I'm not too sure what to do next; I thought at first I would be able to include SDL and then just link to the DLL in the commandline and voila, but perhaps it would seem I need to compile the SDL development library with my program first? My only goal is to have my SDL program wrapped up in a folder that I can distribute to other Windows platforms without the requirement that they have to install anything extra - or would they definitely need to install SDL.dll in the Windows folder?</p>
  
  <p>EDIT: Further clarification - could someone describe the steps that I'd take to do this? I mean, what would a developer looking to distribute his application do? Do most game installers actually put <code>.dll</code> files in the <code>Windows</code> folder when applications like this are installed?</p>
  
  <p>Source (test.cpp):</p>
  
  <pre><code>#include &lt;SDL/SDL.h&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  int main ()
  {
    cout &lt;&lt; "Hello World!";
    return 0;
  }
  </code></pre>
  
  <p>Folder:</p>
  
  <p><code>test.cpp</code>
  <code>SDL.dll</code></p>
  
  <p>Commandline:</p>
  
  <p><code>g++ test.cpp -lSDL</code></p>
  
  <p>Output:</p>
  
  <p><code>test.cpp:2:17: fatal error: SDL.h: No such file or directory</code>
  <code>compilation terminated</code></p>