您的位置:首页 > 汽车 > 时评 > 04-Ubuntu 22.04LTS安装 json (jsoncpp/jsonc)

04-Ubuntu 22.04LTS安装 json (jsoncpp/jsonc)

2024/9/8 10:42:48 来源:https://blog.csdn.net/jiangchufeng123/article/details/140659600  浏览:    关键词:04-Ubuntu 22.04LTS安装 json (jsoncpp/jsonc)

文章目录

  • 1. jsoncpp安装指令
    • 1.1 验证
    • 1.2. 使用
    • 1.3. 编译
  • 2. jsonc安装指令
    • 2.2 验证
    • 2.2 使用
    • 2.2 编译

1. jsoncpp安装指令

sudo apt-get install libjsoncpp-dev

1.1 验证

# 检查是否安装成功
ls /usr/include/jsoncpp/json/

1.2. 使用

#include <jsoncpp/json/json.h>

1.3. 编译

g++ -ljsoncpp

2. jsonc安装指令

sudo aptitude install libjson-c-dev
---------------------------------------------------
The following NEW packages will be installed:libjson-c-dev{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 60.4 kB of archives. After unpacking 291 kB will be used.
The following packages have unmet dependencies:libjson-c-dev : Depends: libjson-c5 (= 0.15-2build4) but 0.15-3~ubuntu1.22.04.2 is installed
The following actions will resolve these dependencies:Keep the following packages at their current version:
1)     libjson-c-dev [Not Installed]---------------------------------------------------
Accept this solution? [Y/n/q/?] n
---------------------------------------------------
The following actions will resolve these dependencies:Downgrade the following packages:
1)     libjson-c5 [0.15-3~ubuntu1.22.04.2 (now) -> 0.15-2build4 (jammy)]---------------------------------------------------
Accept this solution? [Y/n/q/?] y
---------------------------------------------------
The following packages will be DOWNGRADED:libjson-c5
The following NEW packages will be installed:libjson-c-dev
0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 93.7 kB of archives. After unpacking 291 kB will be used.---------------------------------------------------
Do you want to continue? [Y/n/?] y
---------------------------------------------------
Get: 1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjson-c5 amd64 0.15-2build4 [33.3 kB]
Setting up libjson-c-dev (0.15-2build4) ...
Processing triggers for libc-bin (2.35-0ubuntu3.7) ...

2.2 验证

ls /usr/include/json-c/

2.2 使用

#include <json-c/json.h>

2.2 编译

g++ -ljson-c

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com