title: Static linking of MySQL in C/C++
body: <p>I am trying to develop an application that uses MySQL using C++. I downloaded the library from their website and I have attempted to compile the following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  #include &lt;mysql.h&gt;
  using namespace std;
  int main()
  {
      MYSQL *connection, mysql;
      MYSQL_RES *result;
      MYSQL_ROW row;
      mysql_init(&amp;mysql);
  }
  </code></pre>
  
  <p>The line that has <code>mysql_init(&amp;mysql);</code> gives me a compilation error </p>
  
  <pre><code>undefined reference to `mysql_init@4'
  </code></pre>
  
  <p>I am guessing this is due to a library error. I am linking <code>mysqlclient.lib</code> and <code>libmysql.lib</code> in that order. What do I need to do to make this compile without requiring a dll file? Is that possible? Thank you.
  Note: I am using mingw32 on Windows 7 x64 to develop an application for Windows.</p>