问题描述
我已经通过网络阅读了很多有关msgpack的信息,但是找不到关于此问题的任何帮助。
#include<msgpack.hpp>
int main(){
struct item {
std::time_t currentTime;
std::map<std::string,std::string> base;
};
struct obj {
std::string eventName;
item item1;
std::map<std::string,std::string> dateTime;
};
obj obj1[1];
obj1[0].eventName = "TEMP_EVENT";
obj1[0].item1.base["Id"] = "6ba1ce80";
obj1[0].dateTime["TimeFormat"] = "DateTime";
std::stringstream buffer;
msgpack::pack(buffer,obj1);// this line is throwing the error
return 0;
}
看到以下错误,我正在使用msgpack-c库
left of '.msgpack_pack' must have class/struct/union
~\packages\msgpack-c.0.5.9.1\build\native\include\msgpack\object.hpp(192):
note: type is 'const obj [1]'
~\packages\msgpack-c.0.5.9.1\build\native\include\msgpack\object.hpp(155):
note: while compiling class template member function
'msgpack::v1::packer<Stream>
&msgpack::v1::detail::packer_serializer<Stream,T>::pack(msgpack::v1::packer<Stream>
&,const T (&))'
with
[
Stream=std::stringstream,T=obj [1]
]
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)