Skip navigation

So, how do you get started with cURL?

Visual Studio 2005 project files that get you started.

Problems that were resolved and how:

Mostly linker problems:

First linker problem you get

error LNK2019: unresolved external symbol __imp__curl_global_cleanup referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_global_init referenced in function _main

* Resolved by following yang’s grandmother’s 14 step process

SECOND linking problem you get (after resolving the first)

Linking...
curllib.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
curllib.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap 

* Resolved by linking in wldap32.lib by yang

23 Comments

    • Ryan
    • Posted May 4, 2009 at 9:30 pm
    • Permalink

    This fucking piece of shit didn’t help me one little fucking bit.
    I followed it EXACTLY, SEVERAL TIMES!
    All it did was give me more of the “unresolved external” errors.
    Fuck this.

    • matt
    • Posted June 14, 2009 at 5:44 pm
    • Permalink

    the only thing missing (that resolves the above problem) is to (last thing in step 15)
    right click MyFirstAttempt
    properties
    all releases
    configuration properties
    linker
    input
    and set
    additional dependencies
    to
    libcurl.lib ws2_32.lib winmm.lib wldap32.lib

    its the wldap32.lib which is required, see:
    http://curl.haxx.se/mail/lib-2007-11/0300.html

    • Anonymous
    • Posted October 27, 2009 at 9:08 pm
    • Permalink

    @Ryan: This is why software developers are so highly paid. Dumbasses like you dont have the patience to put any effort forth.

    Thanks. One less person to compete with.

  1. C’mon now Anonymous, you can’t say you haven’t ever been that frustrated before..

    • Daivuk
    • Posted December 14, 2009 at 4:57 pm
    • Permalink

    Just note, I am also trying to fix “unresolved external symbol __imp_ curl_easy_setopt” and adding the libs Ryan say doesn’t help.

    • Daivuk
    • Posted December 14, 2009 at 5:13 pm
    • Permalink

    Ok, if that can help other people, I found the problem :)
    I’ve been so lucky to find it…
    You have to add the preprocessors:
    ;BUILDING_LIBCURL;HTTP_ONLY

    And, the libs that Ryan mentioned.
    This way it works…

    • Stir
    • Posted February 5, 2010 at 11:27 am
    • Permalink

    Thx ;-)

    • Anonymous
    • Posted July 26, 2010 at 8:13 am
    • Permalink

    @Daivuk: THANK YOU! =)

    • Iain Collins
    • Posted November 5, 2010 at 4:17 pm
    • Permalink

    @matt

    Thanks big time, I just needed to link winmm.lib wldap32.lib and didn’t know what the libs to use.

    @Daivuk

    I don’t have to do that(using VS2008 and Curl 7.21.2) but thanks for that info too, I didn’t know about HTTP_ONLY.

    • infant_coder
    • Posted November 10, 2010 at 10:13 am
    • Permalink

    Hi, You need to include curllib.lib to remove

    error LNK2019: unresolved external symbol __imp__curl_global_cleanup referenced in function _main
    error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
    error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
    error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
    error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
    error LNK2019: unresolved external symbol __imp__curl_global_init reference

  2. For me to solve
    … To solve unresolved external symbol …
    Under VC++ 2008 was just add:
    #include “stdio.h”

    • Anonymous
    • Posted January 14, 2011 at 12:49 am
    • Permalink

    thanks you saved me some time

    • BigDru
    • Posted April 20, 2011 at 3:30 am
    • Permalink

    TYTYTYTYTYTTYTYTY OMG FINALLY GOT IT TO WORK!!! YOUR AWESOME :D +1

    • Anonymous
    • Posted September 4, 2011 at 7:18 pm
    • Permalink

    Thanks, scanned through the instructions and adjusted my project appropriately. Two minutes from start to finish.

    You saved me from an evening of visual studio frustration!

  3. just add

    libcurl_imp.lib

    with
    libcurl.lib or libcurl.dll

    to the linker.

    • Anon
    • Posted November 26, 2011 at 3:00 pm
    • Permalink

    Chand, I love you.

    • Anonymous
    • Posted January 23, 2012 at 7:05 pm
    • Permalink

    I can confirm libcurl_imp.lib solving the issue of compiling, although now when I run the program it can’t find the dll? any ideas?

  4. @ Anonymous about it not being able to find the dll. Put the libcurl DLL next to your executable and make sure and distribute it along with your executable.

    • Anonymous
    • Posted May 24, 2012 at 4:05 pm
    • Permalink

    Make sure you have the library path setup in your project directory settings to the appropriate curl lib files (debug/release). In my case I have curl and curlpp in the same folder, so “..\curl\lib\LIB-Release” gets added to the project Library Directory settings release builds.

    • Thomas
    • Posted June 6, 2012 at 2:43 pm
    • Permalink

    Hello !
    For me what all of you said does not work :(
    I get :
    1>Filters.obj : error LNK2019: unresolved external symbol _curl_easy_cleanup@4 referenced in function “void __stdcall sendconfinfos(int)” (?sendconfinfos@@YGXH@Z)
    1>Filters.obj : error LNK2019: unresolved external symbol _curl_easy_perform@4 referenced in function “void __stdcall sendconfinfos(int)” (?sendconfinfos@@YGXH@Z)
    1>Filters.obj : error LNK2019: unresolved external symbol _curl_easy_init@0 referenced in function “void __stdcall sendconfinfos(int)” (?sendconfinfos@@YGXH@Z)

    Here is my ‘Linker/Additional dependencies’ :
    libcurl.lib curllib.lib WS2_32.Lib winmm.lib wldap32.lib curllib_static.lib libcurl_imp.lib ssleay32.lib openldap.lib libeay32.lib odbc32.lib odbccp32.lib strmbasd.lib

    Here is my ‘Preprocessor/Preprocessor definitions’ :
    _WIN32_WINNT=0x0400;WINVER=0x0400;DBG=1;DEBUG;_DEBUG;INC_OLE2;STRICT;WIN32;_WIN32;_DLL;_MT;_X86_=1;CURL_STATICLIB;BUILDING_LIBCURL;HTTP_ONLY

    Here is my ‘Advanced/Undefine Preprocessor definitions’ : (these are inherited, but I disable it as said in the yang grandmother’s 14 steps)
    _WINDLL;_USRDLL

    I can’t handle it ! Could anyone help me ? I suppose there is some incompatibility with another Preprocessor definition but I do not find it…

    Thank you for helping !
    Thomas

    • Thomas
    • Posted June 8, 2012 at 12:12 pm
    • Permalink

    Ok I found it finally :
    You must set C/C++/Advanced/Calling Convention to “__cdecl (/Gd)”
    I also removed anything from ‘Advanced/Undefine Preprocessor definitions’.

    Hope it will help :)

    PS : It happened to me because I was working from a driver sample originated configured as “__stdcall (/Gz)”.

    • Ann
    • Posted March 29, 2013 at 6:58 pm
    • Permalink

    Thanks so much for this guide. This fixed all my linking/unresolved issues errors. : )

  5. Hey, I think your website might be having browser compatibility issues.
    When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that,
    wonderful blog!


2 Trackbacks/Pingbacks

  1. […] in misc Instead of fighting with libcurl you could just use WinInet for your http needs if you are married to the Windows […]

  2. […] Atentos al paso 2, para solucionar los problemas de linkado con ldap:  https://bobobobo.wordpress.com/2008/11/08/working-with-curl-getting-started-the-easy-way-on-win32/ […]

Leave a comment