user1107190
user1107190

Reputation: 37

Implementing CURL with Visual Studio 2010

I am trying to compile a program that uses Curl in Visual Studio 2010 on Windows Vista x64. I downloaded the latest version of Curl 7.23.1 from the official website and unzipped it to C:Program Files. From there, I opened the VCProject file in the lib directory, converted it, and built it in Visual C++ Express Version. This resulted in the creation of a debug folder in the lib folder with object files, sbr files, and a libcurl.lib file. After that I opened a W32 Console Application in Visual Studio, added the include folder to include directories, added the debug folder to library directories and additional library directories under Linker, and added libcurl.lib to additional dependencies. When trying to compile my code, I received the following errors:

Error   1   error LNK2001: unresolved external symbol __imp__curl_easy_setopt   C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error   2   error LNK2001: unresolved external symbol __imp__curl_easy_perform  C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error   4   error LNK2001: unresolved external symbol __imp__curl_easy_init C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error   3   error LNK2001: unresolved external symbol __imp__curl_easy_cleanup  C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error   5   error LNK1120: 4 unresolved externals   C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Release\Run.exe Run

I have tried following some tutorials online but they are all outdated. The procedure I followed is supposed to work on Visual Studio 2008. I thought that maybe I may be missing some header files or have not built/compiled parts of Curl. Thanks for any help.

Upvotes: 3

Views: 2619

Answers (1)

Xan
Xan

Reputation: 776

I have faced almost the same issue while trying to statically link the libcurl.lib using vs2010 professional edition.

try performing a pragma link like this one in the source file. It worked for me.

#pragma comment(lib, "libcurl.lib")

or

if the path is missing in search..

#pragma comment(lib, "<full_path>/libcurl.lib")

Upvotes: 0

Related Questions