need some help in compiling a jsoncpp sample code

独自空忆成欢 提交于 2019-12-02 03:13:26

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.

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

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>.

Anurag

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

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!