0

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

Sergey
  • 31
  • 3
  • 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:- https://stackoverflow.com/questions/4445418/how-do-i-add-additional-libraries-in-c – sonulohani Sep 11 '18 at 05:17
  • 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 Answers1

0

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.

Sergey
  • 31
  • 3