need some help in compiling a jsoncpp sample code

后端 未结 5 1052
离开以前
离开以前 2021-01-25 01:31

I am trying to compile a sample jsoncpp example, but there are tons of compiling errors showing up in \"standard\" headers. did any body see this any time ?

[~]         


        
相关标签:
5条回答
  • 2021-01-25 01:49

    Check JSON include path. In compilation option use -I/path of JSON include directory, e.g. -I$(pkg-config --cflags jsoncpp).

    0 讨论(0)
  • 2021-01-25 01:51

    If you compile with -I.../include/json, then the standard library might accidentally include a JSON header. (In this case, according to asuter, it was features.h.)

    The parent directory is a kind of "namespace" for header files. That's why a good practice for any library with headers like incdir/foo/bar.h is -Iincdir and #include <foo/bar.h>.

    0 讨论(0)
  • 2021-01-25 01:54

    That's the kind of thing that would happen if one of your headers that preceded it had a syntax error such as a missing ; at end of class declaration. Start by cleaning those.

    0 讨论(0)
  • 2021-01-25 02:01

    You need to include header file using this way: #include "json/json.h"

    0 讨论(0)
  • 2021-01-25 02:03

    For me it was the features.h included with json-cpp conflicting with the system features.h in some other includes. I renamed it locally to json_features.h in the json-cpp code and all was well.

    0 讨论(0)
提交回复
热议问题