这个是Json.cpp文件
void Json()
{
ver.StartObject();
ver.Key("Time");
ver.Int64(Time);
ver.Key("Results");
ver.String("Ture");
ver.EndObject();
return;
}
这个是main.cpp文件
int main()
{
ver.StartObject();
ver.Key("Name");
ver.String("Krinz");
ver.Key("Gender");
ver.String("男");
ver.Key("Details");
ver.StartArray();
thread th1(Json);
ver.EndArray();
ver.EndObject();
string sys = buffer.GetString();
cout << sys << endl;
system("pause");
return 0;
}
这个是include.h文件
#ifndef CIRCLE_H
#define CIRCLE_H
#include <stdio.h>
#include <string>
#include <iostream>
#include <stdlib.h>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
using std::cout;
using std::endl;
using std::string;
using namespace rapidjson;
StringBuffer buffer;
Writer<StringBuffer> ver(buffer);
#endif // !CIRCLE_H
我想将这两个函数使用同一个结构,但这样好像失败了
是还有什么办法将他们拼接起来吗?