C++版RestClient链接:https://github.com/mrtazz/restclient-cpp
一、这里简单说一下搭建环境的坑:
- 他的环境第一个推荐的是Linux的,第二个是Windows的。我用的是第二个。
- 由于在Windows环境下最便捷的安装方式是通过Vcpkg,这里推荐:https://www.cnblogs.com/linuxAndMcu/p/14696542.html#_label3_4。这是我目前找到的所有版本里各种错误概括最全的。Ps:一定要网好,需要从github上下载不少的东西。
二、上代码:
#include <iostream>
#include<ctime>
#include "restclient-cpp/connection.h"
#include "restclient-cpp/restclient.h"
using namespace std;
int main()
{
cout << "start:\n";
//std::cout << "Hello World!\n";
clock_t startTime, endTime;
for (int i = 0; i < 10; i++) {
RestClient::init();
startTime = clock();
//获得一个coonecton对象