gcc 不包括 c 头文件 json-c
gcc doesn't include c header file json-c
在 Macbook 上,我正在用 json-c(https://github.com/json-c/json-c)
制作一些东西
gcc a.c
a.c:1:10: fatal error: 'json.h' file not found
#include "json.h"
^
1 error generated.`>
当我尝试编译它时,
它打印出错误,但我在包含文件中有 json.h
文件。
> cd /usr/local/include/json-c/
> ls
arraylist.h json_config.h json_tokener.h
bits.h json_inttypes.h json_util.h
debug.h json_object.h linkhash.h
json.h json_object_iterator.h printbuf.h
json_c_version.h json_object_private.h random_seed.h
/usr/include/json-c/json.h 肯定存在
编译器可能在其包含路径中没有 json-c
子目录。
运气好的话,您可以将其添加到您的收录中:
#include "json-c/json.h"
这仅在 header 为 stand-alone 时有效,即它不再引用 json-c/
.
中的任何其他 header
如果失败,您必须在调用它时告诉编译器:
$ gcc -I/usr/local/include/json-c/ a.c
在 Macbook 上,我正在用 json-c(https://github.com/json-c/json-c)
制作一些东西gcc a.c
a.c:1:10: fatal error: 'json.h' file not found
#include "json.h"
^
1 error generated.`>
当我尝试编译它时,
它打印出错误,但我在包含文件中有 json.h
文件。
> cd /usr/local/include/json-c/
> ls
arraylist.h json_config.h json_tokener.h
bits.h json_inttypes.h json_util.h
debug.h json_object.h linkhash.h
json.h json_object_iterator.h printbuf.h
json_c_version.h json_object_private.h random_seed.h
/usr/include/json-c/json.h 肯定存在
编译器可能在其包含路径中没有 json-c
子目录。
运气好的话,您可以将其添加到您的收录中:
#include "json-c/json.h"
这仅在 header 为 stand-alone 时有效,即它不再引用 json-c/
.
如果失败,您必须在调用它时告诉编译器:
$ gcc -I/usr/local/include/json-c/ a.c