title: Undefined reference to curl
body: <p>I have to make a project using libcurl on Windows in Code blocks, but when I compile the "undefined reference to curl_global_init" etc. appears, what should I do?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;curl/curl.h&gt;
  #include &lt;curl/types.h&gt;
  #include &lt;curl/easy.h&gt;
  #include &lt;string&gt;
  
  size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
  size_t written = fwrite(ptr, size, nmemb, stream);
  return written;
  }
  
  int main(void) {
  CURL *curl;
  FILE *fp;
  CURLcode res;
  char *url = "http://localhost/aaa.txt";
  char outfilename[FILENAME_MAX] = "C:\\bbb.txt";
  curl = curl_easy_init();
  if (curl) {
      fp = fopen(outfilename,"wb");
      curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/aaa.txt");
      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
      curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
      res = curl_easy_perform(curl);
      /* always cleanup */
      curl_easy_cleanup(curl);
      fclose(fp);
  }
  return 0;
  }
  </code></pre>