win10系统下 jsoncpp mingw 编译
来源:互联网 发布:天津伊势丹有mac吗 编辑:程序博客网 时间:2024/06/05 07:45
jsoncpp是c++的一个json解析库
下载地址 https://github.com/open-source-parsers/jsoncpp
1、准备开发环境Python scons
首先下载Python 2.7+,安装,并且加入到path
然后下载 http://scons.org/pages/download.html
我下载的是
- Zip file scons-2.4.1.zip
官网解释(The Gzip tar file and Zip file are installable using the Python setup.py
script in the package.)
下载完成以后 进入 scans 目录
查看 redeme.txt
INSTALLATION============Assuming your system satisfies the installation requirements in theprevious section, install SCons from this package simply by running theprovided Python-standard setup script as follows: # python setup.py installBy default, the above command will do the following: -- Install the version-numbered "scons-2.4.1" and "sconsign-2.4.1" scripts in the default system script directory (/usr/bin or C:\Python*\Scripts, for example). This can be disabled by specifying the "--no-version-script" option on the command line.
所以执行以下命令
F:\scons-2.4.1 python setup.py install
左右是会把 scons.py scons-2.4.1.py sconsign.py sconsign-2.4.1.py scons-time.py scons-time-2.4.1.py 等脚本 安装到 E:\java\Python27\Scripts 目录下
二、编译
查看jsoncpp的github介绍 。。。
Building and testing with SConsNote: The SCons-based build system is deprecated. Please use CMake; see the section above.JsonCpp can use Scons as a build system. Note that SCons requires Python to be installed.Invoke SCons as follows:scons platform=$PLATFORM [TARGET]where $PLATFORM may be one of:suncc: Sun C++ (Solaris)vacpp: Visual Age C++ (AIX)mingwmsvc6: Microsoft Visual Studio 6 service pack 5-6msvc70: Microsoft Visual Studio 2002msvc71: Microsoft Visual Studio 2003msvc80: Microsoft Visual Studio 2005msvc90: Microsoft Visual Studio 2008linux-gcc: Gnu C++ (linux, also reported to work for Mac OS X)If you are building with Microsoft Visual Studio 2008, you need to set up the environment by running vcvars32.bat (e.g. MSVC 2008 command prompt) before running SCons.
在jsoncpp的根目录执行如下命令进行编译
E:\git\jsoncpp>scons platform=mingw然后会生成一个静态库
jsoncpp目录 --- buildscons\mingw\src\lib_json这个目录下有四个文件
json_reader.ojson_value.ojson_writer.olibjson_mingw_libmt.a把整个目录全部拷贝到工程目录的跟目录下
然后按照如下步骤配置一下静态库
编译的时候会执行如下命令
g++ -DCURL_STATILIB -O3 -Wall -c -fmessage-length=0 -o "src\\main.o" "..\\src\\main.cpp" g++ "-LE:\\git\\jsoncpp\\buildscons\\mingw\\src\\lib_json" -o http-c.exe "src\\main.o" -ljson_mingw_libmt
-ljson_mingw_libmt 是使用到的静态库。。。。
具体需要查一下g++的用法。。。。
然后简单写一个demo
std::string strValue = "{\"key1\":\"value1\",\"array\":[{\"key2\":\"value2\"},{\"key2\":\"value3\"},{\"key2\":\"value4\"}]}";Json::Reader reader;Json::Value value;if (reader.parse(strValue, value)) {std::string out = value["key1"].asString();std::cout << out << std::endl;//const Json::Value arrayObj = value["array"];//for (int i = 0; i < arrayObj.size(); i++) {//out = arrayObj[i]["key2"].asString();//std::cout << out;//if (i != arrayObj.size() – 1){//std::cout << std::endl;//}//}}
1 0
- win10系统下 jsoncpp mingw 编译
- jsoncpp在win7下用mingw编译
- win10 vs2015 jsoncpp编译 支持xp系统
- win7下使用mingw编译jsoncpp库并用Qt Creator
- Win10-64位系统安装xgboost(使用MinGW编译)
- linux 下编译jsoncpp
- Linux下编译Jsoncpp
- Linux下编译Jsoncpp
- mac下编译jsoncpp
- bcb2010下编译jsoncpp
- Linux下编译jsoncpp
- Linux下编译Jsoncpp
- win10-x64系统下编译OpenJDK
- CentOS6.6下编译jsoncpp
- MinGw 下编译 FFMPEG
- MinGw 下编译 FFMPEG
- MinGw 下编译 FFMPEG
- MinGW下编译openssl
- Java设计模式:组合模式 Component
- mplayer: could not connect to socket mplayer
- HTTP GET 304
- RabbitMQ基础概念详细介绍
- 彻底弄明白之java多线程中的volatile
- win10系统下 jsoncpp mingw 编译
- 【Elasticsearch】深入Elasticsearch集群
- 谱聚类算法(Spectral Clustering)优化与扩展(转载)
- C#判断两个字符串是否相等的方法
- NIO与传统IO的区别(顶)
- jfreechart中文乱码问题
- MFC中混合使用Duilib制作界面
- 源码安装nss_wrapper方法
- xp下开发的ocx,xp注册成功,win7下注册不成功,