zoukankan      html  css  js  c++  java
  • 解决Ubuntu16.04 fatal error: json/json.h: No such file or directory

    参考博客

    错误产生

    安装json-c库之后,根据GitHub上面的readme文件链接到json-c库时出现以下错误:

    SDMBNJson.h:9:23: fatal error: json/json.h: No such file or directory
     #include <json/json.h>
                           ^
    compilation terminated.
    

    贴出readme:

    Linking to `libjson-c`
    ----------------------
    
    If your system has `pkgconfig`,
    then you can just add this to your `makefile`:
    
    \```make
    CFLAGS += $(shell pkg-config --cflags json-c)
    LDFLAGS += $(shell pkg-config --libs json-c)
     ```
    
    Without `pkgconfig`, you would do something like this:
    
    \```make
    JSON_C_DIR=/path/to/json_c/install
    CFLAGS += -I$(JSON_C_DIR)/include/json-c
    LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c
    \```
    
    

    可是,按照readme上面的做法还是无法解决问题。

    解决方案

    在Linux系统中,/usr/include/ 是C/C++等的头文件放置处,当使用源代码方式安装某些数据时,会使用到其中很多文件。因此将编译安装完成的json-c文件夹改名为“json”放在/usr/include/目录下,即可解决:

    cd /usr/include
    sudo mkdir json
    sudo cp /usr/local/include/json-c/* /usr/include/json/
    
  • 相关阅读:
    Libvirt错误总结
    linux学习
    HMC 命令行登陆设置
    AIX扩VG和扩文件系统
    Bootstrap CSS2
    Bootstrap CSS
    JQuery的实例集合
    JQuery的noConflict()方法
    android的intent实现页面的跳转
    android的activity
  • 原文地址:https://www.cnblogs.com/031602523liu/p/9927093.html
Copyright © 2011-2022 走看看