1.error: ‘*’ does not name a type
加了相应的头文件还是报error: ‘Value’ does not name a type,原型如下:
int XnetSendMsg(std::string to, FrameType method, const Value& root);
解:我这种情况为程序中有多个Value的定义或申明,C++编译器不知道使用哪一个。解决这个问题费了很长时间,主要当时是对代码不熟悉,不清楚代码有多个Json库。如Json::Value、rapidjson::Value等。直到把相应报错的代码屏蔽编译链接时提示重定义,才找到解决办法。此处修改为:
int XnetSendMsg(std::string to, FrameType method, const Json::Value& root);
2.error: expected class-name before ‘{’ token
class XcamMsgHead : public JMsgBase
解:忘记加入继承类JMsgBase的头文件。
3.error: conflicting declaration ‘typedef struct event_time_t event_time_t’
解:头文件相互包含了;
4.undefined reference to `std::allocator<char>::allocator()'
解:改为g++;