How to create and link libCurl in VS project

I am trying to use cURL in a C ++ project that I am working on in VS2010.

I downloaded the latest cURL source and I am creating a solution included in the archive. When I create this project, the only lib output is libcurld_imp.lib. I was expecting "libcul.lib". In any case, I pointed VS to the include directory in which the headers are stored, and added the above lib to my linker dependencies. Finally, I add the folder path of this "libcurld_imp.lib" to the search locations of additional link libraries.

I cannot create my project due to the following linker error:

error LNK1104: cannot open libcurld_imp.lib file

This file exists in the folder that I added to the search path for additional libraries. What am I missing? Thanks

Update

Good .. So I managed to get the libcurl.lib file by editing libcurl proj. The default build settings were set for the output of the DLL. I changed this as a static library. Now that I have libcurl.lib, I get the following binding errors:

Error 3 of LNK2019 error: unresolved external symbol _imp_curl_easy_setopt referenced by the _main function Error 2 of LNK2019 error: unresolved external symbol _imp_curl_easy_perform specified in the _main function

Does anyone know how to tie this frickgen thing?

Another update

The documentation included in the initial download includes the file "build.windows". The instructions say that the following command is used to build the lib library:

nmake / f makefile.vc mode =

I did this using โ€œstaticโ€ as my mode, and โ€œVC = 10โ€ as my option. This creates a library, but is called libcurl_a.lib. Binding to this lib gives the same errors :( Thanks

+4
source share
2 answers

The _ imp suffix in libcurld_imp.lib most likely refers to the import library. You create a DLL, and this file is the lib that you need to link to your exe to invoke the DLL implicitly.

The solution should contain other configurations that allow you to create a static library.

0
source

You need both. Try this suggestion (it is for vs2008, but should work):

http://curl.haxx.se/mail/lib-2009-05/0097.html

0
source

Source: https://habr.com/ru/post/1369427/


All Articles