title: How to Build cURL and use it in a Code::Blocks project (static)
body: <p>I know there are many topics about this but none of them helped me to solve my problem. All I want is to make a simple <strong>C++</strong> program that uses <strong>cURL</strong> with <strong>static libcurl</strong> (without DLL files) on <strong>Code::Blocks - Windows 8</strong>. I've spent around 20 hours trying to do this but all I found is unuseful stuff and stuff I don't understand.</p>
  
  <p>After downloading <strong>curl-7.39.0.zip</strong> from <strong><a href="http://curl.haxx.se/download.html" rel="nofollow">http://curl.haxx.se/download.html</a></strong> and extracting it to my <strong>Code::Block</strong> directory, I ran <strong>Developer Command Prompt for VS2013</strong> as Administrator and entered the following:</p>
  
  <pre><code>cd C:\Program Files (x86)\CodeBlocks\curl-7.39.0\winbuild
  nmake /f Makefile.vc mode=static vc=12 debug=no
  </code></pre>
  
  <p>The output of the second command was: <strong><a href="http://pastebin.com/bwPqxp9V" rel="nofollow">http://pastebin.com/bwPqxp9V</a></strong></p>
  
  <p>Then I made a new empty <strong>Code::Blocks</strong> project with <strong>Main.cpp</strong>:</p>
  
  <pre><code>#include &lt;curl/curl.h&gt;
  int main() { curl_global_cleanup(); }
  </code></pre>
  
  <p>In <strong>Code::Blocks</strong>, I navigated to <strong>Project > Build Options</strong><br>
  In <strong>Compiler Settings > Defines</strong>, I added <code>CURL_STATICLIB</code><br>
  In <strong>Linker Settings > Link Libraries</strong>, I added the path of the .lib file generated (which exists):</p>
  
  <pre><code>..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib
  </code></pre>
  
  <p>In <strong>Linker Settings > Other Link Options</strong>, I added <code>-static</code><br>
  In <strong>Search Directories > Compiler</strong>, I added:</p>
  
  <pre><code>..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\include
  </code></pre>
  
  <p>I may have edited some other stuff, but nothing important.<br>
  When I build using <strong>GNU GCC Compiler</strong> with the following command:</p>
  
  <pre><code>mingw32-g++.exe  -o Debug\MyTestProgram.exe Debug\Main.o  -static  "..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib"
  </code></pre>
  
  <p>I get <strong>80 warnings</strong> similar to:</p>
  
  <pre><code>.drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
  </code></pre>
  
  <p>And more than <strong>50 errors</strong>. What I did wrong and how can I fix it?<br>
  Feel free to ask me for more details if needed.  </p>
  
  <p><strong>Error log</strong>:</p>
  
  <pre><code>..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\easy.obj):(.text$mn+0x7)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\easy.obj):(.text$mn+0x44)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\easy.obj):(.text$mn+0x64)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x13b)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x151)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x10d)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x295)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x2ac)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x17b)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\multi.obj):(.text$mn+0x2ea)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x7)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x80)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x41d)||undefined reference to `_imp__strtoll'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x58f)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x754)||undefined reference to `_imp__strtoll'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x45)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\cookie.obj):(.text$mn+0x57)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\curl_sspi.obj):(.text$mn+0x7)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\curl_sspi.obj):(.text$mn+0xca)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\curl_sspi.obj):(.text$mn+0xfc)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x5a)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x91)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x12e)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x198)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x1ae)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\asyn-thread.obj):(.text$mn+0xaa)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x88)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x7)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x178)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x42)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x7b)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\hostip.obj):(.text$mn+0x8e)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x7)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x12c)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x7)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0xd5)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x115)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x4)||undefined reference to `__security_cookie'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0xa4)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x1c6)||undefined reference to `@__security_check_cookie@4'|
  ..\..\..\..\Program Files (x86)\CodeBlocks\curl-7.39.0\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib(..\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib\url.obj):(.text$mn+0x216)||undefined reference to `@__security_check_cookie@4'|
  ||More errors follow but not being shown.|
  </code></pre>