3
votes

I've been having a bit of trouble using LibCurl with Visual Studio 2010. Keep in mind I'm pretty new to C++.

I built the library according to the instructions on the libcurl website and tried to point my project to the include directory, libcurl.lib, etc but when I try to build the project I get a bunch of LNK2019 errors.

Can someone please walk me through how to tell Visual Studio where the include files, .lib file, etc are (i.e. all the steps after building LibCurl up to using sample code in a test project)?

Thanks in advance.

2
Ok I got it working: added ws2_32.lib and Wldap32.lib. That got it to compile. Then I fixed the error I got by rebuilding libcurl and replacing libcurl.lib and libcurl.dll in my application and it worked. Thanks for your help guys.JonaGik

2 Answers

4
votes

error LNK2001: unresolved external symbol __imp__send@16

Hurray, we have an error message. Add ws2_32.lib to the Additional Dependencies setting. The MSDN Library lists the required import library at the bottom of the article for each API function.

Interpreting the linker error is important to diagnose these errors. Ignore the __imp__ prefix, that's linker glue. You can tell it is trying to find the definition of the send() function. That's a standard socket API function. The MSDN Library article for send() told me you need to add ws2_32.lib to the dependencies. The article is here, scroll to the bottom. This same information should also be available in the library documentation.

0
votes

open the project settings dialog window first (right click >> properties)

this contains everything in regards to getting the project configured

find "Linker", then expand it and go to "Linker >> General"

under "Additional library directories" add the location of the ".lib" files

then go to "Linker>>input" and add the name of the library files you want to include