cURL / Mailing Lists / curl-library / Single Mail


Compiling a strictly statically-linked program

From: Alex Langhart <>
Date: Sat, 4 Jul 2009 20:42:30 -0600

Hello all,
   I've been having a horrific time trying to compile my program into a single .exe file that doesn't depend on the curl .dll files. I'm using Code::Blocks on Windows, and it's using the gcc compiler. The program can compile, link, and run just fine but it requires .dll files. So I added the CURL_STATICLIB #define and it ran into linker errors if I didn't specify the curl's library files (which shows that it is actually doing something with them and not just ignoring the #define). After specifying the library files for the linker, it compiles and runs just fine, but still only works if the .dll files are present. Otherwise I get an error saying the application did not initialize correctly because it can't find libcurl.dll. Something else to note is that the CURL_STATICLIB .exe file is about 600KB larger than the original .exe file.

   Any help would be appreciated, thanks!
Received on 2009-07-05