error LNK2019: unresolved external symbol "__declspec(dllimport)

Apr 29, 2014 at 10:21 AM
Edited Apr 29, 2014 at 1:05 PM
Hi,
So im trying to build my project with casablanca having the newest version installed via nuget.
Im wondering why i m getting link errors when building?

to my project.vcxproj but that doesnt help... i thought the nuget would configurate everything for me is there anything i miss? i get the .lib of my project and theres the cpprest110_2_0.dll in my realease folder but when im trying to build my main projects .exe file with the project included i get all like 35 LNK errors.

EDIT : Ok after adding #pragma comment(lib, "cpprest120_2_0.lib") which is never version and i found under packages im getting other linker errors... But still from the cpprest


error LNK2001: unresolved external symbol ""__declspec(dllimport) public: class pplx::task<class web::http::http_response> __thiscall web::http::client::http_client::request(class web::http::http_request,class pplx::cancellation_token)" (_imp(__imp_?request@http_client@client@http@web@@QAE?AV?$task@Vhttp_response@http@web@@@pplx@@Vhttp_request@34@Vcancellation_token@6@@Z)".
Coordinator
Apr 29, 2014 at 5:49 PM
Hi hoffmeij,

You shouldn't have to make any changes to your project if you are using the Nuget package. Be careful about mixing VS versions, I see you mention cpprest110_2_0.dll and cpprest120_2_0.lib.

Have you created successfully created an application using Casablanca before? If not I highly recommend you start by going through our http_client tutorial.

Steve
Dec 13, 2015 at 9:47 PM
Edited Dec 13, 2015 at 9:48 PM
Hi,

I know that's an oooooold post, and I'm sorry if answering now offends some people, but after spending HOURS trying to find a solution, i finally made it and I thought sharing it would be helpful for anyone looking for it.

So, like hoffmeij, I installed cpprestsdk with the latest version of nuget on Visual Studio 2012, and, first, it didn't made the links in my project correctly, and after making all of them myself, I had the exact same 35 errors first, then only 14 but still...

The solution I found is to install the 2.4.0.1 version of cpprestsdk, I know that's not a good solution, but for temporary needs like mine, it made the match!

I went to the nuget terminal in VS2012 and entered "Install-Package cpprestsdk -Version 2.4.0.1", and it worked!

Before entering it, you might want to uninstall the versions installed in the solution, or you're gonna have to do it yourself in your vcxproj ^^

Hope it will help some lost people,

Burgito