当前位置: 首页 > news >正文

站长工具seo优化建议网站优化公司上海

站长工具seo优化建议,网站优化公司上海,易企网站建设,如何做网上水果网站系统文章目录 0. 代码仓库1 安装1.1 windows 下的安装1.2 Linux 下的安装1.2.1 相关环境配置问题1.2.2 准备安装1.2.2.1 安装scons1.2.2.2 安装jsoncppUbuntu系统下Centos8系统下 2 编译 c 测试文件: json-test.cpp2.1 配置库文件2.2 配置VS2.3 Winsows系统下cpp文件测试…

文章目录

  • 0. 代码仓库
  • 1 安装
    • 1.1 windows 下的安装
    • 1.2 Linux 下的安装
    • 1.2.1 相关环境配置问题
    • 1.2.2 准备安装
      • 1.2.2.1 安装scons
      • 1.2.2.2 安装jsoncpp
        • Ubuntu系统下
        • Centos8系统下
  • 2 编译 c++ 测试文件: json-test.cpp
    • 2.1 配置库文件
    • 2.2 配置VS
    • 2.3 Winsows系统下cpp文件测试
      • 2.3.1 写json测试结果
      • 2.3.2 读json测试结果
  • 3 jsoncpp常用API
    • 3.1 Value -> 对Json支持的数据类型进行封装/解析
    • 3.2 Reader
    • 3.3 FastWriter

0. 代码仓库

https://github.com/Chufeng-Jiang/OpenSSL_Secure_Data_Transmission_Platform/tree/main/Preparation

1 安装

1.1 windows 下的安装

  • 在windows下 将 jsoncpp-0.10.7.tar.gz解压缩

  • 进入到解压目录jsoncpp-0.10.7, 在进入到子目录makefiles\msvc2010

  • 使用vs打开项目文件jsoncpp.sln

  • 编译该项目, 生成库文件

    在这里插入图片描述在这里插入图片描述

在这里插入图片描述

  • 生成的静态库存储目录jsoncpp-0.10.7\makefiles\msvc2010\Debug

  • 生成的静态库文件: lib_json.lib
    在这里插入图片描述

  • 使用的准备工作:

    • 将静态库lib_json.lib拿出备用
    • 将库对应的头文件拿出, 头文件目录jsoncpp-0.10.7\include\json
      在这里插入图片描述
  • 把文件拿出来备用

在这里插入图片描述

  • vs编译过程中, 修改属性
    在这里插入图片描述

1.2 Linux 下的安装

1.2.1 相关环境配置问题

要安装python2,参考以下文章…哎…我把centos下安装py2搞复杂了,浪费了一上午,竟然还打算自己去编译py2的源码,简直脑子进水…

Centos8: 安装python2, 并设置默认版本

  1. python与python3

/usr/bin/env: ‘python’: No such file or directory“:Linux中python口令无效,python3有效

  1. python2和python3 print语句的括号问题
    python2中的语句是不用加括号的,但是python3中的print需要加语句。这导致了使用python3配环境时候出现以下错误
    在这里插入图片描述

1.2.2 准备安装

- `jsoncpp-0.10.7.tar.gz`
- `scons-3.0.5.zip`
  • 解压缩

    tar zxvf jsoncpp-0.10.7.tar.gz
    unzip scons-3.0.5.zip
    

1.2.2.1 安装scons

  • 安装scons -> 进入 scons-3.0.5.zip 的解压目录

     sudo python setup.py install 
    

    在这里插入图片描述

1.2.2.2 安装jsoncpp

  • 安装 jsoncpp -> 进入 jsoncpp-0.10.7.tar.gz 的解压目录
sudo scons platform=linux-gcc

在这里插入图片描述

Ubuntu系统下
// 将生成的动态库/静态库拷贝到系统的库目录中, 需要管理员权限,Ubuntu系统下是gcc11/centos是gcc7
sudo cp libs/linux-gcc-11/* /lib// 拷贝json的头文件到系统目录中, 需要管理员权限
sudo cp include/json/ /usr/include/ -r// 创建动态库的链接文件, 需要管理员权限
sudo ln -s /lib/libjson_linux-gcc-11_libmt.so /lib/libjson.so// 更新, 这样才能搜索到动态库 libjson.so。需要管理员权限
sudo ldconfig    // 测试
sudo ./bin/linux-gcc-11/test_lib_json Testing ValueTest/checkNormalizeFloatingPointStr: OK
Testing ValueTest/memberCount: OK
Testing ValueTest/objects: OK
Testing ValueTest/arrays: OK
..................
Testing BuilderTest/settings: OK
Testing IteratorTest/distance: OK
Testing IteratorTest/names: OK
Testing IteratorTest/indexes: OK
All 53 tests passed

在这里插入图片描述
在这里插入图片描述

Centos8系统下
// 将生成的动态库/静态库拷贝到系统的库目录中, 需要管理员权限,centos是gcc7
sudo cp libs/linux-gcc-7/* /lib// 拷贝json的头文件到系统目录中, 需要管理员权限
sudo cp include/json/ /usr/include/ -r// 创建动态库的链接文件, 需要管理员权限
sudo ln -s /lib/libjson_linux-gcc-7_libmt.so /lib/libjson.so// 更新, 这样才能搜索到动态库 libjson.so。需要管理员权限
sudo ldconfig    
// 测试
sudo ./bin/linux-gcc-7/test_lib_json 
Testing ValueTest/checkNormalizeFloatingPointStr: OK
Testing ValueTest/memberCount: OK
Testing ValueTest/objects: OK
Testing ValueTest/arrays: OK
..................
Testing BuilderTest/settings: OK
Testing IteratorTest/distance: OK
Testing IteratorTest/names: OK
Testing IteratorTest/indexes: OK
All 53 tests passed

在这里插入图片描述

2 编译 c++ 测试文件: json-test.cpp

g++ json-test.cpp -ljson -o json

2.1 配置库文件

把备份的库文件拷贝到工程目录下在这里插入图片描述

2.2 配置VS

在这里插入图片描述在这里插入图片描述

2.3 Winsows系统下cpp文件测试

#include <json.h>
#include <iostream>
#include <fstream>
using namespace Json;	// jsoncpp的命名空间
using namespace std;void writeJson()
{// 组织数据, 并写入到磁盘文件
// [12, 19.8, true, "hello", ["a", "b", "c"], {"name":"xiaoming"}, "age":12]Value v;v.append(Value(12));v.append(19.8);v.append(true);v.append("hello");// 创建一个数组对象 ValueValue arr;arr.append("a");arr.append("b");arr.append("c");// 创建json对象 -> ValueValue obj;obj["name"] = "xiaoming";obj["age"] = 12;v.append(arr);v.append(obj);// 将得到Value对象 v 格式化 -> string -> 写磁盘string st = v.toStyledString();cout << "v style: " << st << endl;FastWriter fw;string jsonText = fw.write(v);cout << "jsonText: " << jsonText << endl;// 创建写文件的流对象// ofstream of;// of.open("test.json");ofstream of("test.json");of << st;of.close();
}void readJson()
{// 1. 将磁盘文件数据读出 -> stringifstream ifs("test.json");// 2. 将string -> Value 对象中Reader rd;Value root;rd.parse(ifs, root);// 3 打印输出// 遍历数组for (int i = 0; i < root.size(); ++i){Value sub = root[i];if (sub.isInt()){cout << sub.asInt() << " ";}else if (sub.isDouble()){cout << sub.asDouble() << " ";}else if (sub.isBool()){cout << sub.asBool() << " ";}else if (sub.isString()){cout << sub.asString() << " ";}else if (sub.isArray()){// 继续遍历这个子数组for (int j = 0; j < sub.size(); ++j){cout << sub[j].asString() << " ";}cout << endl;}else if (sub.isObject()){// 根据对象中的key, 打印value值cout << sub["name"].asString() << ", "<< sub["age"].asInt() << " ";}}
}int main()
{writeJson();
//	readJson();
}

2.3.1 写json测试结果

在这里插入图片描述
在这里插入图片描述

2.3.2 读json测试结果

在这里插入图片描述

3 jsoncpp常用API

3.1 Value -> 对Json支持的数据类型进行封装/解析

// Json支持的数据类型
Type = {int, double, float, string, char*, bool, JsonArray, JsonObject}
// 构造函数Value(ValueType type = nullValue);Value(Int value);Value(UInt value);
#if defined(JSON_HAS_INT64)Value(Int64 value);Value(UInt64 value);
#endif // if defined(JSON_HAS_INT64)Value(double value);Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)Value(const char* begin, const char* end);// 将Value对象转换成对应类型的数据Int asInt() const;UInt asUInt() const;
#if defined(JSON_HAS_INT64)Int64 asInt64() const;UInt64 asUInt64() const;
#endif // if defined(JSON_HAS_INT64)LargestInt asLargestInt() const;LargestUInt asLargestUInt() const;float asFloat() const;double asDouble() const;bool asBool() const;// 判断Value对象中存储的数据的类型bool isNull() const;bool isBool() const;bool isInt() const;bool isInt64() const;bool isUInt() const;bool isUInt64() const;bool isIntegral() const;bool isDouble() const;bool isNumeric() const;bool isString() const;bool isArray() const;bool isObject() const;// 取值 
// 格式化 -> 将对象转换为字符串
// 适合于查看信息或者写文件
std::string toStyledString() const;

3.2 Reader

// json格式字符串 -> Value对象
// c++
bool parse(const std::string& document, Value& root, bool collectComments = true);参数:- document: json字符串, 传入参数- root: 传出参数, 转换完成之后的Value对象
// c用法
bool parse(const char* beginDoc, const char* endDoc, Value& root, bool collectComments = true);参数:- beginDoc: 字符串起始地址- endDoc: 字符串结束地址- root: 传出参数, 转换完成之后的Value对象
// c++用法
bool parse(std::istream& is, Value& root, bool collectComments = true);参数:- is: 文件流对象, 使用这个流对象打开一个磁盘文件- root: 传出参数, 转换完成之后的Value对象

3.3 FastWriter

// 将Value对象中的数据格式化 -> 字符串
// 适合于网络数据的发送
// 得到的字符串中没有换行符
std::string write(const Value& root);// 得到这个返回值:- 写磁盘 -> 写到配置文件中- 网络传参数

文章转载自:
http://quixotical.c7625.cn
http://toneless.c7625.cn
http://calces.c7625.cn
http://liprouge.c7625.cn
http://kemalism.c7625.cn
http://iddd.c7625.cn
http://renfrewshire.c7625.cn
http://sweltry.c7625.cn
http://jackassery.c7625.cn
http://epiphyte.c7625.cn
http://bifurcate.c7625.cn
http://investigator.c7625.cn
http://slavicist.c7625.cn
http://lockgate.c7625.cn
http://experimenter.c7625.cn
http://nsf.c7625.cn
http://mitose.c7625.cn
http://methodenstreit.c7625.cn
http://juncaceous.c7625.cn
http://acuate.c7625.cn
http://pushball.c7625.cn
http://bottomless.c7625.cn
http://uses.c7625.cn
http://sayest.c7625.cn
http://machinize.c7625.cn
http://endogenic.c7625.cn
http://timberheaded.c7625.cn
http://braggart.c7625.cn
http://lobster.c7625.cn
http://cabb.c7625.cn
http://arborescent.c7625.cn
http://polytheist.c7625.cn
http://somberly.c7625.cn
http://katana.c7625.cn
http://felibre.c7625.cn
http://commy.c7625.cn
http://jul.c7625.cn
http://landscaper.c7625.cn
http://casquet.c7625.cn
http://trefa.c7625.cn
http://ticker.c7625.cn
http://undesirous.c7625.cn
http://underdrift.c7625.cn
http://subassembly.c7625.cn
http://anodic.c7625.cn
http://remorselessly.c7625.cn
http://alleviate.c7625.cn
http://outsoar.c7625.cn
http://harmonia.c7625.cn
http://inapprehension.c7625.cn
http://pingo.c7625.cn
http://tachymetry.c7625.cn
http://molybdenite.c7625.cn
http://bemaze.c7625.cn
http://mythologist.c7625.cn
http://fogless.c7625.cn
http://capitalist.c7625.cn
http://mien.c7625.cn
http://butut.c7625.cn
http://flirt.c7625.cn
http://spirited.c7625.cn
http://metencephalic.c7625.cn
http://swanherd.c7625.cn
http://equative.c7625.cn
http://woundward.c7625.cn
http://ostentation.c7625.cn
http://robin.c7625.cn
http://youthwort.c7625.cn
http://integrallty.c7625.cn
http://zinnia.c7625.cn
http://valentinite.c7625.cn
http://tonsillotomy.c7625.cn
http://reluctate.c7625.cn
http://executer.c7625.cn
http://aaronic.c7625.cn
http://manwise.c7625.cn
http://letterspacing.c7625.cn
http://illiterati.c7625.cn
http://oxid.c7625.cn
http://ascogonium.c7625.cn
http://pinnacled.c7625.cn
http://epigram.c7625.cn
http://isostemony.c7625.cn
http://misdirection.c7625.cn
http://ionogen.c7625.cn
http://dynamite.c7625.cn
http://byobu.c7625.cn
http://spatula.c7625.cn
http://bitternut.c7625.cn
http://lazuli.c7625.cn
http://iliyria.c7625.cn
http://turfman.c7625.cn
http://evaluating.c7625.cn
http://seacraft.c7625.cn
http://cube.c7625.cn
http://ballistite.c7625.cn
http://vagodepressor.c7625.cn
http://erasure.c7625.cn
http://eht.c7625.cn
http://kalimba.c7625.cn
http://www.zhongyajixie.com/news/83238.html

相关文章:

  • 瑞安网站建设网站seo视频教程
  • wordpress入站密码广告联盟平台挂机赚钱
  • dw网站制作效果怎么做会计培训班的费用是多少
  • 长沙企业网站建设公如何在网上推广产品
  • 郑州的建设网站有哪些广州网站推广服务
  • 遵义市做网站的电话在线企业管理培训课程
  • 珠海做网站的网络公司网页界面设计
  • 学做效果图网站有哪些搜索引擎优化的技巧
  • 网站建设与维护一样吗引流推广多少钱一个
  • 加强县政府网站建设的几点建议网站推广的作用在哪里
  • wordpress 众筹网站搜索引擎网址
  • 食品网站建设需求分析防疫管控优化措施
  • 漳州做网站建设的公司推广竞价托管公司
  • app下载做任务赚钱网站云南百度推广开户
  • 什么网站动物和人做的培训机构在哪个平台找
  • 怎么做代刷网站教程网站推广优化的原因
  • 如何在线上推广产品厦门seo测试
  • 如何用asp做网站的登录界面热搜排行榜今日排名
  • erp开发和网站开发近三天发生的大事
  • 做网站建设的公司有哪些北京营销型网站
  • 什么是企业云网站建设seo排名怎样
  • 网站开发源代码百度一下你就知道了
  • 国外网站众筹怎做百度一下百度搜索百度
  • 连云港网站建设电话网站排名seo教程
  • 网站整体设计苏州网站建设制作公司
  • 英文网站如何建设站长工具忘忧草社区
  • 网站的大小推广优化关键词
  • 浙江华洋建设有限公司网站seo优化软件购买
  • 山西省太原建设工程信息网站长沙网站推广seo
  • asp网站改php网站方法网络推广与营销