0

I am having some issues regarding statically linking libcurl into my Win32 console project in Visual Studio 2015. I have been struggling with this issue for 4-5 hours and I could not figure it out. I am hoping someone can help me explain what I am doing wrong.

I did this

Compiled libcurl.lib using "LIB RELEASE" (x64) configuration. Then I moved the include headers and the library to my own win32 console project (x64) and set it up as follows:

VC++ => Include directories -> $(SolutionDir)includes (contains curl headers)
     => Library directories -> $(SolutionDir)libraries (contains libcurl.lib)
Linker => Additional Library Directories -> $(SolutionDir)libraries
       => Input -> libcurl.lib  

I can compile fine when I don't use any curl functions, but when I invoke curl_easy_init() in my own source code and compile, then it gives me the following errors:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol __imp_curl_easy_cleanup referenced in function "void __cdecl ee(void)" (?ee@@YAXXZ)  Console C:\Users\Ik\Documents\Visual Studio 2015\Projects\SDK4\Console\Console.obj  1   
Error   LNK2019 unresolved external symbol __imp_curl_easy_init referenced in function "void __cdecl ee(void)" (?ee@@YAXXZ) Console C:\Users\Ik\Documents\Visual Studio 2015\Projects\SDK4\Console\Console.obj  1

I expected the following

I expected that the curl package is statically linked in my project and I can use curls functions properly.

curl/libcurl version

curl-7.52.1

operating system

Microsoft Windows [Version 10.0.14393]

Steffen Brem
  • 1,738
  • 18
  • 29

1 Answers1

0

In the projects you statically link libcurl try to add this definiton: CURL_STATICLIB

This governs how the import/export macro is resolved in curl/curl.h