jsoncpp

Compiling and Using JSONCPP on Visual Studio10 with Boost

徘徊边缘 提交于 2019-11-28 20:40:24
I have recently compiled the SVN version of JSONCPP using the VS71 makefiles. It worked, but I get a lot of linker errors 1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE_JPBD_J@Z) already defined in JSONCPP.lib(json_writer.obj) 1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ)

Json in C++: Parse a number as a string to avoid floating-point inaccuracy

两盒软妹~` 提交于 2019-11-28 10:33:40
问题 I'm dealing with a cryptocurrency RPC and receiving json data as follows: { ... "amount": 1.34000000, "confirmations": 230016, "spendable": true, "solvable": true ... } Using Jsoncpp library or json11 gets the number parsed to a double . When this happens, the result is: 1.3400000000000001 , due to double accuracy problems. In general this is catastrophic to financial transations and unacceptable. I already have a fixed-point library that can take a valid string and treat it as an integer

【jsoncpp】c++解析json数据包

对着背影说爱祢 提交于 2019-11-28 01:16:26
安装jsoncpp apt-get install libjsoncpp-dev 项目中加入头文件 #include <jsoncpp/json/json.h> 编译命令后面加上 -ljsoncpp 用下面的代码和makefile进行测试,是否安装成功。 //test.cpp # include <iostream> # include <string> # include <jsoncpp/json/json.h> using namespace std ; int main ( ) { Json :: Value json_temp ; json_temp [ "name" ] = Json :: Value ( "sharexu" ) ; json_temp [ "age" ] = Json :: Value ( 18 ) ; Json :: Value root ; root [ "key_string" ] = Json :: Value ( "value_string" ) ; root [ "key_number" ] = Json :: Value ( 12345 ) ; root [ "key_boolean" ] = Json :: Value ( false ) ; root [ "key_double" ] = Json :: Value ( 12.345

cmake和json安装

微笑、不失礼 提交于 2019-11-27 16:54:19
一、cmake源码安装 官网下载源码: https://cmake.org/download/ 安装: ./bootstrap make make install cmake --version 二、json安装 下载源码: https://github.com/open-source-parsers/jsoncpp/tree/1.8.3 安装: cd jsoncpp mkdir -p ./build/debug cd ./build/debug cmake -D CMAKE_BUILD_TYPE=debug -D BUILD_STATIC_LIBS=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local/jsoncpp -D CMAKE_C_COMPILER=/usr/local/bin/gcc -D CMAKE_CXX_COMPILER=/usr/local/bin/g++ -G "Unix Makefiles" ../.. make && make install 安装完后,编译代码是需要指定路径 来源: https://www.cnblogs.com/shuqingstudy/p/11370907.html

How to read a JSON file containing multiple root elements?

孤街浪徒 提交于 2019-11-27 09:45:39
If I had a file whose contents looked like: {"one": 1} {"two": 2} I could simply parse each separate line as a separate JSON object (using JsonCpp ). But what if the structure of the file was less convenient like this: { "one":1 } { "two":2 } Neither example in your question is a valid JSON object; a JSON object may only have one root. You have to split the file into two objects, then parse them. You can use http://jsonlint.com to see if a given string is valid JSON or not. So I recommend either changing what ever is dumping multiple JSON objects into a single file to do it in seperate files,

AndroidStudio用Cmake方式编译NDK代码(cmake配置.a库)

我与影子孤独终老i 提交于 2019-11-27 03:04:06
AndroidStudio用Cmake方式编译NDK代码(cmake配置.a库) 1.cmake是什么? CMake是一个跨平台的安装( 编译 )工具,可以用简单的语句来描述所有平台的安装(编译过程)。他能够输出各种各样的makefile或者project文件,能测试 编译器 所支持的C++特性,类似UNIX下的automake。 谷歌从AndroidStudio2.2以上就添加了Cmake方式来编译NDK代码,并从NDK例子看出,默认编译的方式就是cmake方式。 2.谷歌官方的用cmake方式编译NDK的教程 谷歌从AndroidStudio2.2以上就添加了Cmake方式来编译NDK代码,并从NDK例子看出,默认编译的方式就是cmake方式。 如果您希望向现有项目添加原生代码,请执行以下步骤: 创建新的原生源文件 并将其添加到您的 Android Studio 项目中。 如果您已经拥有原生代码或想要导入预构建的原生库,则可以跳过此步骤。 创建 CMake 构建脚本 ,将您的原生源代码构建到库中。如果导入和关联预构建库或平台库,您也需要此构建脚本。 如果您的现有原生库已经拥有 CMakeLists.txt 构建脚本或者使用 ndk-build 并包含 Android.mk 构建脚本,则可以跳过此步骤。 提供一个指向您的 CMake 或 ndk-build 脚本文件的路径, 将

Linux下配置jsoncpp库

[亡魂溺海] 提交于 2019-11-26 18:34:34
[root@postgresql json]# uname - a Linux postgresql 2.6 . 18 - 308.13 . 1 .el5 # 1 SMP Tue Aug 21 17 : 10 : 18 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux 下载jsoncpp 和scons(类似GnuMake的工具) http://sourceforge.net/projects/jsoncpp http://www.scons.org/ 装scons # tar -zxvf scons- 2.2 . 0 . tar .gz #cd scons - 2.2 . 0 #python setup.py install 编译jsoncpp # tar -zxvf jsoncpp-src- 0.6 . 0 -rc2. tar .gz #cd jsoncpp -src- 0.6 . 0 - rc2 #scons platform =linux- gcc # mv -r include/json /usr/include/ # mv libs/linux- gcc - 4.1 . 2 /libjson_linux- gcc - 4.1 .2_libmt.so /usr/lib/ libjsoncpp.so # mv libs/linux- gcc -