Merge pull request #1469 from GOLinux/master

Translated:20140807 Linux FAQs with Answers--How to fix 'fatal error--jsoncpp or json or json.h--No such file or directory'.md
This commit is contained in:
joeren 2014-08-08 20:05:27 +08:00
commit c7f96269ab
2 changed files with 39 additions and 39 deletions

View File

@ -1,39 +0,0 @@
Linux FAQs with Answers--How to fix “fatal error: jsoncpp/json/json.h: No such file or directory”
================================================================================
> **Question**: I am trying compile a C++ application, but I am getting the following error:
>
> "fatal error: jsoncpp/json/json.h: No such file or directory"
>
> How can I fix this problem?
The error indicates that you are missing JsonCpp development files (i.e., JsonCpp library and header files). [JsonCpp][1] is a C++ library for JSON-formatted data manipulation. Here is how to install JsonCpp development files on various Linux distros.
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install libjsoncpp-dev
On Fedora:
$ sudo yum install jsoncpp-devel
On CentOS, JsonCpp is not available as a pre-built package. So you can build and install JsonCpp from the source as follows.
$ sudo yum install cmake
$ git clone https://github.com/open-source-parsers/jsoncpp.git
$ cd jsoncpp
$ mkdir -p build/debug
$ cd build/debug
$ cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../../
$ make
$ sudo make install
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/fix-fatal-error-jsoncpp.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://github.com/open-source-parsers/jsoncpp

View File

@ -0,0 +1,39 @@
Linux常见问题与答案——如何修复“fatal error: jsoncpp/json/json.h: No such file or directory”问题
================================================================================
>**问题**我试着编译一个C++程序,但是我碰到了以下错误:
>
>“fatal error: jsoncpp/json/json.h: No such file or directory”
>
>我怎样修复这个问题呢?
该错误指出你缺少JsonCpp开发文件例如JsonCpp库和头文件。[JsonCpp][1]是一个用于JSON格式数据复制的C++库。下面给出了在不同Linux发行版上安装JsonCpp开发文件的方法。
在Debian, Ubuntu或者Linux Mint上
$ sudo apt-get install libjsoncpp-dev
在Fedora上
$ sudo yum install jsoncpp-devel
在CentOS上没有JsonCpp的预编译包。因此你可以通过以下方法从源码构建一个JsonCpp包并安装。
$ sudo yum install cmake
$ git clone https://github.com/open-source-parsers/jsoncpp.git
$ cd jsoncpp
$ mkdir -p build/debug
$ cd build/debug
$ cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../../
$ make
$ sudo make install
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/fix-fatal-error-jsoncpp.html
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://github.com/open-source-parsers/jsoncpp