Libcurl inside Qt: can't find external symbol



  • Hi,

    I have downloaded qt for my 64bit windows 8 machine and I am trying to use the curl library in my project. Please note that curl is a required and can't be avoided.

    So, I have downloaded a zip file from the website and in my .pro files I have added the following lines:

    DEFINES += CURL_STATICLIB
    INCLUDEPATH += "C:/Users/User/Documents/QTProjects/next/include"
    win32:LIBS += -L"C:/Users/User/Documents/QTProjects/next/lib" -lcurllib

    Where ../next/lib contains:

    • curllib.lib
    • curllib_static.lib
    • curllib.dll

    In my main function:

    @
    #define CURL_STATICLIB //not needed since defined in .pro
    #include <curl/curl.h>
    .....
    CURL *curl;
    CURLcode res;
    curl = curl_easy_init();@

    When I try to build and compile the project I come across this error:

    LNK2019: unresolved external symbol curl_easy_init referenced in function...

    Any ideas what is going wrong with this? I managed to get it to work with visual studio 2012 but Qt doesn't seem to like it.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You might have better chance to get an answer on the curl mailing list/forums.

    Anyway, shouldn't it be:

    @LIBS += -lcurl@

    ?



  • Getting the same error even with this modification :/


  • Lifetime Qt Champion

    Sorry, I have misread the name of your libraries, it seems that you indeed need to have curllib in your pro file.

    Since you are doing a static build (guessing that from your define) shouldn't you link to curllib_static ?

    @LIBS += -lcurllib_static@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.