Qt4第三方库QJSON编译说明
来源:互联网 发布:服装设计绘图软件 编辑:程序博客网 时间:2024/05/16 14:08
1. 下载QJSON源文件压缩包qjson-0.8.1.tar.bz2
2. 在Qt Create上使用cmake命令编译QJSON
(a) Qt Create中打开QJSON源文件中的CMakeLists.txt文件。
(b) 弹出Run CMake设置界面,点击界面上的”Run CMake”检测通过,然后点击”Finish”按钮完成cmake环境配置。
(c) 最后执行build命令编译源文件,会在lib目录下生成qjson.lib和qjson.dll文件,编译完成。
3. 使用QJSON例程
#include <QCoreApplication>
#include <QVariantMap>
#include <QDebug>
#include "./src/parser.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QString json("{"
"\"encoding\" : \"UTF-8\","
"\"plug-ins\" : ["
"\"python\","
"\"c++\","
"\"ruby\""
"],"
"\"indent\" : { \"length\" : 3, \"use_space\" : true }"
"}");
QJson::Parser parser;
bool ok;
QVariantMap result = parser.parse (json.toAscii(), &ok).toMap();
if (!ok) {
qFatal("An error occurred during parsing");
exit (1);
}
qDebug() << "encoding:" << result["encoding"].toString();
qDebug() << "plugins:";
foreach (QVariant plugin, result["plug-ins"].toList()) {
qDebug() << "\t-" << plugin.toString();
}
QVariantMap nestedMap = result["indent"].toMap();
qDebug() << "length:" << nestedMap["length"].toInt();
qDebug() << "use_space:" << nestedMap["use_space"].toBool();
return app.exec();
}
- Qt4第三方库QJSON编译说明
- Qt4 使用QJson库
- QJson编译
- QJson编译
- qjson编译
- FFMPEG第三方库编译
- 第三方库的编译
- ios 编译第三方库
- Jni 编译第三方库
- 第三方库编译启示
- 第三方库编译笔记
- window上编译vs的qjson库
- C++ GUI Programming with Qt4 Second Edition 之 B.2 使用第三方编译工具
- qjson编译方法
- QJSON的编译方法
- QJSON的编译方法
- QJSon的编译
- ffmpeg第三方库编译记录
- Regex
- 单例模式(DCL缺陷以及如何安全发布对象)
- [LeetCode] Gray Code
- Codeforces Round #259 (Div. 2)C. Little Pony and Expected Maximum(数学期望)
- ios修改textField的placeholder的字体颜色、大小
- Qt4第三方库QJSON编译说明
- text-indent在ie6下input发生位移
- wpf 异步命令
- 法国的好的好的
- Spring加载配置文件的三种方式
- [LeetCode] Sort Colors
- POSIX 线程详解
- Centos6.5上安装xen及图形化界面管理
- UVa1647Computer Transformation