problem with cpprestapi in visual studio 2017 can't found POST/GET constants
problem with cpprestapi in visual studio 2017 can't found POST/GET constants
Have code in client of API
#include "cpprest/http_msg.h"
...
http_request req;
req.set_method(web::http::methods::POST);
...
During linking have messages:
1>client.obj : error LNK2001: unresolved external symbol "public:
static class std::basic_string,class std::allocator > const
web::http::methods::GET"
(?GET@methods@http@web@@2V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@B)
1>client.obj : error LNK2001: unresolved external symbol "public:
static class std::basic_string,class std::allocator > const
web::http::methods::POST"
(?POST@methods@http@web@@2V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@B)
It is disappear when remove line req.set_method(web::http::methods::POST);
As I understand web::http::methods::POST is constant so must builded in client.obj. Do not understand yet.
It is static link. Possible problem with basic_string
Ofcourse all patch setted right. It is worked good with prevois version of library. In addition to that it has problem only with static class web::http::methods all other function linked. I use vspkg it set all patch self.
– Sergey
Sep 11 '18 at 12:13
1 Answer
1
vcpkg build cpprest for static and dynamic linckink. Problem name of both is equivalent. So it try use dynamic lib instead static.
Did rename extra library - project built. I think VCPKG must have option for swich library will investigate.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Have you provided library path in VS 2017 property page. Its complaining for the library it needs to link. Please check this link for more info:- stackoverflow.com/questions/4445418/…
– sonulohani
Sep 11 '18 at 5:17