How to build and use curl as static library with Visual Studio 2017

Khiem Doan · 17K views · 2018 · 12:34

Open on YouTube

C, C++, Rust, Go & systems languagesTesting, debugging & developer toolstutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when they are trying to build libcurl statically in Visual Studio and hit LNK2019 unresolved external symbol errors.

Recommended by 1 people across 1 different months, 2018 to 2019.

What it is

A screen-recorded tutorial by Khiem Doan showing how to download the curl source, build it as a static library with Visual Studio 2017, and link it into a C++ project. It walks through the build and project setup steps on Windows.

What people said

Recommends CompG33k · 2019-03 · Stack Overflow · on “C++ cURL linking error "unresolved external symbol _curl_easy_"”

Credit to this guy helped me get further than any docs. Still have a couple more issues. [this video] Then do this , someone in the video comments Very important after you do everything in video. Need to navigate back to solution right click properties (see below comment) "Thanks , it worked after i added Normaliz.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;advapi32.lib in Additional Dependencies(property->linker->input)"

Cites Yawning Gull · 2018-06 · Stack Overflow · on “LNK2019 Error using libcurl”

I've been getting this error for a while now, so as a last resort I followed This video [this video] to the letter.. and still got the same errors. So, here's the code I produced: #include <iostream> #include <string> #define CURL_STATIC #include "curl/curl.h" #ifdef _DEBUG # pragma comment (lib, "curl/libcurl_a_debug.lib") #else # pragma comment (lib, "curl/libcurl_debug.lib") #endif static int writer(char *data, size_t size, size_t nmemb, std::string *writerData) { if (writerData == NULL) return 0; writerData->append(data, size*nmemb); return size * nmemb; } int wmain(int argc, wchar_t *argv[], wchar_t *envp[]) { std::cout << "Hello curl!"; std::string content; curl_global_init(CURL_GLOBAL_ALL)

Cites pushE · 2018-08 · Stack Overflow · on “LIBCURL error in VS2017 C++ :: error LNK2019: unresolved external symbol _curl_easy_init”

I compiled CURL for windows to use in VS2017 as shown in this video [this video] Also i have defined CURL_STATICLIB in preprocessor in C/C++ configuration properties. Actual project properties is as [LINK] But it get below unresolved symbol errors for LIBCURL only 1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_init 1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_setopt 1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_perform 1>mainfile.obj : error LNK2001: unresolved external symbol _curl_easy_cleanup Please help in resolving , it 5 hrs i have been trying to remove this :(