jsoncpp安装

  JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式。 易于人阅读和编写。同时也易于机器解析和生成。 它基于JavaScript Programming LanguageStandard ECMA-262 3rd Edition - December 1999的一个子集。 JSON采用完全独立于语言的文本格式,但是也使用了类似于C语言家族的习惯(包括C, C++, C#, Java, JavaScript, Perl, Python等)。 这些特性使JSON成为理想的数据交换语言。

  请先阅读一遍下面的所有操作再做操作,下面的过程我是经过实践检验过的

1. 下载地址:

  https://github.com/open-source-parsers/jsoncpp

2. jsoncpp最新版要求:

  CMake 2.8.5 or higher is required.

3. 下载cmake:

  https://cmake.org/download/

4. 安装cmake:

  ./bootstrap --prefix=/home/test/support/storm-cpp/cmake-3.4.3/install

  gmake

  make install

  编辑.bash_profile,在LD_LIBRARY_PATH,PATH中添加配置

5. python的要求:

  Found unsuitable version "2.4.3", but required is at least "2.6" (found /usr/bin/python2

  下载地址:https://www.python.org/downloads/release/python-351/ 

  tar xf Python-3.5.1.tgz

  ./configure --prefix=/home/test/support/storm-cpp/Python-3.5.1/install --bindir=/home/test/support/storm-cpp/Python-3.5.1/install/bin

  make && make install

  若python已经安装了一个低版本,有两个解决方案:

    1)可参见下面的地址进行处理:http://www.aichengxu.com/view/37456

      2)参见下面gcc安装后的处理方式。

   配置完成后: python -V 看看版本号对不

 6. gcc: ftp://gd.tuwien.ac.at/gnu/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.gz

  gmp: https://gmplib.org/

    ./configure --prefix=/home/test/support/storm-cpp/gmp-6.1.0/install/

    make && make install

  mpfr: http://www.mpfr.org/mpfr-current/#download

    ./configure --prefix=/home/test/support/storm-cpp/mpfr-3.1.3/install/

    make && make install

  mpc: http://www.multiprecision.org/index.php?prog=mpc&page=download

    ./configure --prefix=/home/test/support/storm-cpp/mpc-1.0.3/install --bindir=/home/test/support/storm-cpp/mpc-1.0.3/install/bin --with-mpfr-include=/home/test/support/storm-cpp/mpfr-3.1.3/install/include --with-mpfr-lib=/home/test/support/storm-cpp/mpfr-3.1.3/install/lib --with-gmp-include=/home/test/support/storm-cpp/gmp-6.1.0/install/include --with-gmp-lib=/home/test/support/storm-cpp/gmp-6.1.0/install/lib

    make && make install

  编辑.bash_profile,在LD_LIBRARY_PATH中添加gmp,mpfr,mpc配置

   gcc install:

    ./configure --prefix=/home/test/support/storm-cpp/gcc-5.3.0/install --bindir=/home/test/support/storm-cpp/gcc-5.3.0/install/bin --with-mpfr-include=/home/test/support/storm-cpp/mpfr-3.1.3/install/include --with-mpfr-lib=/home/test/support/storm-cpp/mpfr-3.1.3/install/lib --with-gmp-include=/home/test/support/storm-cpp/gmp-6.1.0/install/include --with-gmp-lib=/home/test/support/storm-cpp/gmp-6.1.0/install/lib --with-mpc-include=/home/test/support/storm-cpp/mpc-1.0.3/install/include --with-mpc-lib=/home/test/support/storm-cpp/mpc-1.0.3/install/lib

    make && make install

   注意,如果系统有多个版本也不用担心,无需做任何处理,只要在.bash_profile中添加下面的几个配置项就可以让gcc和python使用最新版本了:

STORM_HOME=/home/test/support/storm-cpp
MPFR=$STORM_HOME/mpfr-3.1.3/install
GMP=$STORM_HOME/gmp-6.1.0/install
MPC=$STORM_HOME/mpc-1.0.3/install
PYTHON_35=$STORM_HOME/Python-3.5.1/install
GCC_53=$STORM_HOME/gcc-5.3.0/install
CMAKE=$STORM_HOME/cmake-3.4.3/install

export PATH=$GCC_53/bin:$CMAKE/bin:$PYTHON_35/bin:/usr/share/vim:$PATH
export LD_LIBRARY_PATH=$GCC_53/lib:$MPFR/lib:$GMP/lib:$MPC/lib:$LD_LIBRARY_PATH

export LIBRARY_PATH=$GCC_53/lib:$GCC_53/libexec:$PYTHON_35/lib
export C_INCLUDE_PATH=$GCC_53/include
export CPLUS_INCLUDE_PATH=$GCC_53/include

   当然,如果想使用以前的版本,把上面的配置去掉就可以啦!

7.安装jsconcpp

  先执行cmake .

  修改CMakeCache.txt中的配置:

    ARCHIVE_INSTALL_DIR:PATH

    CMAKE_C_COMPILER:FILEPATH

    CMAKE_C_COMPILER:FILEPATH

  好了,开始执行make && make install

8.哪个项目使用的话就可以引用jsoncpp生成的库和头文件啦。

9.That's all.

原文地址:https://www.cnblogs.com/foreverstars/p/5160918.html