c++ 之编译错误

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++;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值