open-source-parsers / jsoncpp

A C++ library for interacting with JSON.
Other
8.17k stars 2.65k forks source link

Linux : error: missing binary operator before token "(" 报了一堆错 #1174

Closed lzpong closed 4 years ago

lzpong commented 4 years ago
In file included from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097:0,
                 from /usr/include/c++/4.8.2/string:38,
                 from src/../../JsonCpp/include/config.h:9,
                 from src/../../JsonCpp/include/forwards.h:10,
                 from src/../../JsonCpp/include/value.h:10,
                 from src/C_Thread.cpp:1:
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:44:19: error: missing binary operator before token "("
 #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
                   ^
In file included from /usr/include/c++/4.8.2/cwchar:44:0,
                 from /usr/include/c++/4.8.2/bits/postypes.h:40,
                 from /usr/include/c++/4.8.2/bits/char_traits.h:40,
                 from /usr/include/c++/4.8.2/string:40,
                 from src/../../JsonCpp/include/config.h:9,
                 from src/../../JsonCpp/include/forwards.h:10,
                 from src/../../JsonCpp/include/value.h:10,
                 from src/CThread.cpp:1:
/usr/include/wchar.h:74:43: error: missing binary operator before token "("
 # if defined __cplusplus && __GNUC_PREREQ (4, 4)
                                           ^
In file included from /usr/include/sched.h:42:0,
                 from /usr/include/pthread.h:23,
                 from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/gthr-default.h:35,
                 from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/gthr.h:148,
                 from /usr/include/c++/4.8.2/ext/atomicity.h:35,
                 from /usr/include/c++/4.8.2/bits/basic_string.h:39,
                 from /usr/include/c++/4.8.2/string:52,
                 from src/../../JsonCpp/include/config.h:9,
                 from src/../../JsonCpp/include/forwards.h:10,
                 from src/../../JsonCpp/include/value.h:10,
                 from src/CThread.cpp:1:
/usr/include/bits/sched.h:132:20: error: missing binary operator before token "("
 # if __GNUC_PREREQ (2, 91)
                    ^
/usr/include/bits/sched.h:170:20: error: missing binary operator before token "("
 # if __GNUC_PREREQ (2, 91)

原因:   jsoncpp中有一个features.h文件,在/usr/include下也有一个同名的文件,所以就出现文件依赖顺序等问题,一旦搞混,就报了一堆错

解决方法:   把jsoncpp的 features.h重命名,然后json.h与reader.h要引用它,在相应的位置换成新的文件名字就ok了。

dota17 commented 4 years ago

Have been done in #1024