嗨朋友们 你能帮忙解决这个与C ++ REST API有关的错误 我写了一个小代码。
Hi friends can you help to resolve this error which is related to C++ REST API I have written a small code .
<br /> #include "stdafx.h"<br /> #include <cpprest/http_client.h><br /> #include <cpprest/filestream.h><br /> #include <cpprest/json.h> // JSON library<br /> #include <cpprest/uri.h> // URI library<br /> #include <cpprest/http_msg.h><br /> <br /> using namespace web;<br /> using namespace web::http;<br /> using namespace web::http::client;<br /> using namespace utility; // Common utilities like string conversions<br /> //using namespace concurrency;<br /> using namespace std;<br /> using namespace pplx; <br /> <br /> int _tmain(int argc, _TCHAR* argv[])<br /> {<br /> <br /> http_client client(U("127.0.0.1:13581"));<br /> <br /> // Build request URI and start the request.<br /> uri_builder builder(U("/abcd/version"));<br /> <br /> auto a = client.request(methods::GET);<br /> <br /> return 0;<br /> <br /> }<br />似乎缺少库文件。我找不到哪个lib文件 错误信息 错误LNK2001:未解析的外部符号__declspec(dllimport)public:class Concurrency :: task< class> __thiscall web :: http :: client :: http_client :: request(class web :: http :: http_request,class Concurrency :: cancellation_token const&)( __imp_?request @ http_client @ client @ http @ web @@ QAE?AV?$ task @ Vhttp_response @ http @ web @@@ Concurrency @@ Vhttp_request @ 34 @ ABVcancellation_token @ 6 @@ Z)
it seems there is library file is missing . I couldn't find which lib file is that Error Message error LNK2001: unresolved external symbol "__declspec(dllimport) public: class Concurrency::task<class> __thiscall web::http::client::http_client::request(class web::http::http_request,class Concurrency::cancellation_token const &)" (__imp_?request@http_client@client@http@web@@QAE?AV?$task@Vhttp_response@http@web@@@Concurrency@@Vhttp_request@34@ABVcancellation_token@6@@Z)
推荐答案task @ Vhttp_response @ http @ web @@@ Concurrency @@ Vhttp_request @ 34 @ ABVcancellation_token @ 6 @@ Z) task@Vhttp_response@http@web@@@Concurrency@@Vhttp_request@34@ABVcancellation_token@6@@Z)
你可能没有关注过C ++ REST API的安装说明( casablanca.codeplex/wikipage?title=Http% 20Client%20Tutorial [ ^ ]和 casablanca.codeplex/wikipage?title=Using%20NuGet%20to%20add%20the%20C%2b%2b%20REST%20SDK%20to%20a%20VS%20project [ ^ ])。 根据以上链接,图书馆的路径应该是已添加到您的项目中。如果您还没有这样做,可以在安装目录中找到库路径,并将其手动添加到项目设置中。 You may have not followed the installation instructions for the C++ REST API (casablanca.codeplex/wikipage?title=Http%20Client%20Tutorial[^] and casablanca.codeplex/wikipage?title=Using%20NuGet%20to%20add%20the%20C%2b%2b%20REST%20SDK%20to%20a%20VS%20project[^]). According to the above links, the path to the library should have been added to your project. If you have not done that you might locate the library path inside the installation directory and add it manually to your project settings.
更多推荐
C ++ REST API错误:链接器错误
发布评论