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

苏州相城区做网站百度一下马上知道

苏州相城区做网站,百度一下马上知道,网站建设网站建设,杭州高端网站建设公司哪家好由于在编译PaddleOCR中出现YamlCpp错误,所以需要编译最新的Yaml-cpp项目测试,具体步骤如下: 一、下载yaml-cpp源码编译,下载地址如下: https://gitcode.com/gh_mirrors/ya/yaml-cpp.git https://raw.gitcode.com/gh_…

由于在编译PaddleOCR中出现YamlCpp错误,所以需要编译最新的Yaml-cpp项目测试,具体步骤如下:

一、下载yaml-cpp源码编译,下载地址如下:

https://gitcode.com/gh_mirrors/ya/yaml-cpp.git
https://raw.gitcode.com/gh_mirrors/ya/yaml-cpp/archive/refs/heads/master.zip
GitCode - 全球开发者的开源社区,开源代码托管平台

二、解压缩yaml-cpp-master.zip文件到D:\yaml-cpp-master目录

三、打开Cmake软件,配置源码编译选项,生成VS项目解决方案文件。

编译选项主要包括:

3.1设置源码目录:D:/yaml-cpp-master,设置构建目录:D:/yaml-cpp-master/build_vs2022

3.1设置编译器为:VS2022+X64

3.2不勾选BUILD_TESTING 选项

3.3勾选YAML-BUILD-SHARED_LIBS选项

依次点击【Configure】按钮、【Generate】按钮、【Open Project】按钮。 

四、在VS2022软件中打开D:\yaml-cpp-master\build_vs2022\YAML_CPP.sln解决方案文件。

4.1选择编译方式为Release+X64

4.2选择的【YAML_CPP】解决方案,鼠标右键点击【重新生成解决方案】菜单后即可生成对应的动态文件到D:\yaml-cpp-master\build_vs2022\Release目录。

4.3选择的【INSTALL】 项目,鼠标右键点击【重新生成解决方案】菜单后,编译项目成功,安装到 Cmake中配置的路径:C:\Program Files\YAML_CPP。

五、打开QTCreator软件,新建项目testYamlCppVs2022到D:\QtCode\testYamlCppVs2022目录,拷贝对应的文件夹C:\Program Files\YAML_CPP到项目D:\QtCode\testYamlCppVs2022\YAML_CPP目录下。

修改项目.pro文件,新增库引用代码如下:

#添加msvc+x64编译器对应的yaml-cpp驱动引用
#https://gitcode.com/gh_mirrors/ya/yaml-cpp.git
INCLUDEPATH += $$PWD/YAML_CPP/include
DEPENDPATH  += $$PWD/YAML_CPP/include
LIBS += -L$$PWD/YAML_CPP/lib -lyaml-cpp

修改main.cpp文件代码如下:

#include <iostream>
#include <fstream>
#include <QApplication>
#include <QDebug>
#include <QFile>
#include <QDir>
#include <QTime>
#include <QTextCodec>
#include "yaml-cpp/yaml.h"struct Vec3
{double x, y, z;
};struct T_SystemConfig
{std::string version;std::vector<int> indexes;Vec3 start;Vec3 end;QMap<QString, double> map;
};namespace YAML
{template <>struct convert<Vec3>{//Vec3解码static bool decode(const Node &node, Vec3 &rhs){rhs.x = node["x"].as<double>();rhs.y = node["y"].as<double>();rhs.z = node["z"].as<double>();return true;}};//Vec3  写入YAML::Emitter &operator<<(YAML::Emitter &out, const Vec3 &rhs){out << YAML::BeginMap;out << YAML::Key << "x";out << YAML::Value << rhs.x;out << YAML::Key << "y";out << YAML::Value << rhs.y;out << YAML::Key << "z";out << YAML::Value << rhs.z;out << YAML::EndMap;return out;}
}bool saveSysConfig(const QString &path, const T_SystemConfig &config)
{try{QTextCodec *code = QTextCodec::codecForName("GB2312");std::string stdpath = code->fromUnicode(path).data();YAML::Emitter tEmitter;tEmitter << YAML::BeginMap;   //map//std::stringtEmitter << YAML::Key << "version";tEmitter << YAML::Value << config.version;//std::vector<int>tEmitter << YAML::Key << "indexes";tEmitter << YAML::Value << YAML::Flow << config.indexes;//Vec3tEmitter << YAML::Key << "start";tEmitter << YAML::Value << config.start;tEmitter << YAML::Key << "end";tEmitter << YAML::Value << config.end;//QMap<QString, QString>tEmitter << YAML::Key << "map";tEmitter << YAML::BeginMap;for (QString tKey : config.map.keys()){tEmitter << YAML::Key << tKey.toStdString();tEmitter << YAML::Value << config.map.value(tKey);}tEmitter << YAML::EndMap;tEmitter << YAML::EndMap;std::ofstream tFout(stdpath);tFout << tEmitter.c_str();tFout.close();}catch (YAML::Exception &e){qDebug() << QString(e.what());return false;}return true;
}bool parseSysConfig(const QString &path, T_SystemConfig &config)
{try{QTextCodec *code = QTextCodec::codecForName("GB2312");std::string stdpath = code->fromUnicode(path).data();YAML::Node tRoot = YAML::LoadFile(stdpath);//std::stringconfig.version = tRoot["version"].as<std::string>();qDebug() << QString::fromStdString(config.version);//std::vector<int>YAML::Node indexesNode = tRoot["indexes"];for (unsigned int i = 0; i < indexesNode.size(); i++){config.indexes.push_back(indexesNode[i].as<int>());qDebug() << indexesNode[i].as<int>();}//Vec3config.start = tRoot["start"].as<Vec3>();config.end = tRoot["end"].as<Vec3>();qDebug() << config.start.x << config.start.y << config.start.z;qDebug() << config.end.x   << config.end.y   << config.end.z;//QMap<QString, QString>for(YAML::const_iterator it = tRoot["map"].begin(); it != tRoot["map"].end(); ++it){std::string first = it->first.as<std::string>();double second = it->second.as<double>();config.map.insert(QString::fromStdString(first), second);}qDebug()  << config.map;}catch (YAML::Exception &e){qDebug() << QString(e.what());return false;}return true;
}int main(int argc, char *argv[])
{T_SystemConfig writeConfig;writeConfig.version = "1.0.0";writeConfig.indexes = {2, 3, 6, 7, 9, 1, 0};writeConfig.start.x = 0;writeConfig.start.y = 0;writeConfig.start.z = 0;writeConfig.end.x = 30;writeConfig.end.y = 40;writeConfig.end.z = 50;writeConfig.map.insert("agr1", 22);writeConfig.map.insert("agr2", 33);writeConfig.map.insert("agr3", 44);writeConfig.map.insert("agr4", 55);saveSysConfig("test.yaml", writeConfig);T_SystemConfig readConfig;parseSysConfig("test.yaml", readConfig);return 0;
}

运行项目,输入正确的结果如下:

http://www.dtcms.com/wzjs/221948.html

相关文章:

  • 做销售的 都有什么网站重庆网站建设维护
  • 做网站简单还是写程序北京网站开发
  • 南京网站开发公司电脑培训班
  • 做企业手机网站营销推广方式都有哪些
  • 海南城乡住房建设厅网站网站设计流程
  • 常州网站建设公司价位百度客服系统
  • 上传网站到二级域名做一个网站要花多少钱
  • 郑州网站建设e00市场调研报告的基本框架
  • 如何看网站是用什么框架做的百度网址安全检测中心
  • 山东省住房和城乡建设厅网站首页宁波seo关键词如何优化
  • 淮安公司做网站爱站网关键词查询系统
  • 网站结构框架图怎么做百度推广投诉中心
  • wordpress 写php页面跳转安卓aso优化
  • 有网站如何做app抖音关键词排名查询工具
  • 网站开发 语音谷歌三件套下载
  • 汉中做网站2020最近的新闻大事10条
  • 旅游网站设计国内seo服务商
  • 买空间的网站好如何去做网络推广
  • 宜昌网站建设哪家好电商是做什么的
  • 绵阳科技网站建设全网推广软件
  • 上海做网站那家好友情链接英语
  • 网站怎么建设好看今日国内新闻最新消息
  • 南京汽车集团网站建设关键词排名优化怎么样
  • 微信网站制作企业站长工具seo综合查询 分析
  • 网站建设课程设计实训报告公众号如何推广运营
  • 安阳市哪里做网站建设十大成功营销策划案例
  • 做网站要学些什么网站群发推广软件
  • 聊城市住房和城乡建设局网站首页营销平台建设
  • 免费网站怎么制作百度快照网址
  • 怎么做代购彩票网站百度云网盘网页版登录