C ++ REST API错误:链接器错误

编程入门 行业动态 更新时间:2024-10-12 12:25:01
本文介绍了C ++ REST API错误:链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨朋友们 你能帮忙解决这个与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错误:链接器错误

本文发布于:2023-11-28 15:01:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642890.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   链接   REST   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!