问题
rapidjson 创建 json 数据,使用 std::string
字符串进行赋值,编译时,抱一堆错误
....
rapidjson/include/rapidjson/document.h:690:5: note: candidate expects 0 arguments, 1 provided
[build] make[2]: *** [main/CMakeFiles/main.dir/build.make:132: main/CMakeFiles/main.dir/src/face_db.cc.o] Error 1
[build] make[2]: *** Waiting for unfinished jobs....
[build] make[1]: *** [CMakeFiles/Makefile2:98: main/CMakeFiles/main.dir/all] Error 2
[build] make: *** [Makefile:111: all] Error 2
...
解决
设置 RAPIDJSON_HAS_STDSTRING 为1 ,使其支持 std::string
#define RAPIDJSON_HAS_STDSTRING 1
在使用 rapidjson 的头文件中添加 宏定义即可;