title: How to create standalone program by static linking in Code::Blocks
body: <p>I want to run my program standalone. It is simple connection to MySQL using libmysql.lib and requires libmysql.dll in order to run (have it in same folder). Now my question is, how could i compile in c::b so I can use my executable on other machine and will not require .dll? I heard about static libraries but I have no idea how it works, so would be really nice if someone could explain me the process.</p>
  
  <p>P.S. I use GNU CC Compiler.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;winsock.h&gt;
  #include &lt;mysql.h&gt;
  
  
  using namespace std;
  
  
  int main() {
  
  MYSQL *connect;
  MYSQL_RES *res_set;
  MYSQL_ROW row;
  connect = mysql_init(NULL);
  
  
  connect = mysql_real_connect(connect, "HOST", "USER", "PASS", "Server", 3306, NULL, 0);
  
  while( true ) {
      mysql_query(connect, "SELECT * FROM Server");
  
      res_set = mysql_store_result(connect);
  
      while( row = mysql_fetch_row(res_set) ) {
          cout &lt;&lt; row[0] &lt;&lt; " " &lt;&lt; row[1] &lt;&lt; " " &lt;&lt; row[2] &lt;&lt; endl;
      }
      Sleep(2000);
  }
  
  mysql_close(connect);
  
  
  return 0;
  }
  </code></pre>