C++编译找不到uuid库下‘uuid_generate’函数

最近C++开发项目中使用uuid库遇到些错误和解决方法分享:

错误描述:

函数uuid_generate没有申明

In file included from xxx.cpp:9:
xxx/uuid_util.hpp: In function ‘std::string xxx::xxx::GenerateUuid()’:
xxx/uuid_util.hpp:25:12: error: aggregate ‘uuid_t guid’ has incomplete type and cannot be defined
     uuid_t guid;
            ^~~~
xxx/uuid_util.hpp:26:5: error: ‘uuid_generate’ was not declared in this scope
     uuid_generate(reinterpret_cast<unsigned char*>(&guid));
     ^~~~~~~~~~~~~
xxx/uuid_util.hpp:26:5: note: suggested alternative: ‘uuid_create’
     uuid_generate(reinterpret_cast<unsigned char*>(&guid));
     ^~~~~~~~~~~~~
     uuid_create
xxx/uuid_util.hpp:27:5: error: ‘uuid_unparse’ was not declared in this scope
     uuid_unparse(guid, buffer);
     ^~~~~~~~~~~~
xxx/uuid_util.hpp:27:5: note: suggested alternative: ‘uuid_compare’
     uuid_unparse(guid, buffer);
 

解决方法:

需要安装libuuid-devel库,  yum命令:yum -y install libuuid-devel

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值