我试图在CordBug编译器中创建C++中的REST API客户端。这就是为什么,我是
following this tutorial :
#include <cpprest/http_listener.h>
#include <cpprest/json.h>
#pragma comment(lib, "cpprest110_1_1")
using namespace web;
using namespace web::http;
using namespace web::http::experimental::listener;
#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;
#define TRACE(msg) wcout << msg
#define TRACE_ACTION(a, k, v) wcout << a << L" (" << k << L", " << v << L")\n"
map<utility::string_t, utility::string_t> dictionary;
/* handlers implementation */
int main()
{
http_listener listener(L"http://localhost/restdemo");
listener.support(methods::GET, handle_get);
listener.support(methods::POST, handle_post);
listener.support(methods::PUT, handle_put);
listener.support(methods::DEL, handle_del);
try
{
listener
.open()
.then([&listener](){TRACE(L"\nstarting to listen\n");})
.wait();
while (true);
}
catch (exception const & e)
{
wcout << e.what() << endl;
}
return 0;
}
现在,当我要在代码块中摩擦cpp文件时,会出现以下错误:
fatal error: cpprest/http_listener.h: No such file or directory
如何解决此错误?你能给我一个链接吗?从哪里我可以想到在C++中创建REST API和REST客户机?