microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.99k stars 1.65k forks source link

Use cpprestsdk in Visual Studio 2022 #1729

Open Rodeck500 opened 1 year ago

Rodeck500 commented 1 year ago

I have used cpprestsdk in Visual Studio 2015 for about 3 years and it has worked well. Now I must switch to Visual Studio 2022 and which cpprestsdk doesn't have support for. My projects fail to build with a large number of linker errors. I have tried to add the header files for cpprestsdk into my projects in an effort to solve the linker errors, but it has not helped. What can I do?

barcharcraz commented 1 year ago

I would recommend using vcpkg to build cpprestsdk, you can set "VCPKG_PLATFORM_TOOLSET" to "v143" in your triplet to force it to use vs2022, but if you are using "manifest mode" then it will automatically match the toolset you're using to build the project. If you only have vs2022 installed vcpkg will always use it.

The old nuget packages are not supported anymore, and should really not be used. Actually, you should consider migrating all the c++ nuget packages you use to vcpkg.

Rodeck500 commented 1 year ago

I am using vcpkg although I am no expert on it. I have added set(VCPKG_PLATFORM_TOOLSET 143) to my triplet but get an error when I try to build cpprestsdk saying: Could not find Visual Studio instance with 143 toolset.

Am I doing something wrong or what can be the reason?

I have read about "manifest mode" and it looks interesting, but I need to read more before I fully understand how to use it.

Rodeck500 commented 1 year ago

It was a hazzle to get the "manifest mode" working but eventually I managed to do it. Thanks for the help.

vickoza commented 1 year ago

I think you can use vcpkg to install c++ rest sdk in Visual Studio 2022