CentOS7安装aria2报错-'make_unique' was not declared in this scope解决记录

aria2下载地址:https://github.com/aria2/aria2/releases/tag/release-1.34.0

下载tar.gz包:aria2-release-1.34.0.tar.gz

解压:tar -xzvf aria2-release-1.34.0

编译:cd aria2-release-1.34.0 ; ./configure ; make

报错:

……………………

CXX InternalDHKeyExchange.lo

In file included from InternalDHKeyExchange.h:40:0,

from InternalDHKeyExchange.cc:36:

bignum.h: In constructor 'bignum::ulong<dim>::ulong()':

bignum.h:34:25: error: 'make_unique' was not declared in this scope

inline ulong() : buf_(make_unique<char_t[]>(dim)) {}

^

bignum.h:34:43: error: expected primary-expression before '[' token

inline ulong() : buf_(make_unique<char_t[]>(dim)) {}

^

bignum.h:34:44: error: expected primary-expression before ']' token

inline ulong() : buf_(make_unique<char_t[]>(dim)) {}

^

bignum.h: In constructor 'bignum::ulong<dim>::ulong(size_t)':

bignum.h:35:33: error: 'make_unique' was not declared in this scope

inline ulong(size_t t) : buf_(make_unique<char_t[]>(dim))

^

bignum.h:35:51: error: expected primary-expression before '[' token

inline ulong(size_t t) : buf_(make_unique<char_t[]>(dim))

……………………

第一感觉:这是git上release版本不应该会有类似错误,一定是我哪里配置的不对,上网百度想办法吧,尝试了以下方法:

1.网上说std有make_unique这个方法,怀疑是没有引用std,于是在bignum.h 的make_unique 前面都加上了 std:: 结果报错:make_unique 不是 std 的成员。。。失败;

2.又有一篇帖子说在bignum.h增加一段代码,但是帖子并没有详细说明加在哪里,俺也不知道,俺也不敢问,随便找了2个地方加上尝试仍然报错。。。没有继续尝试——失败;

3.算了在源码路径下看有没有定义吧,于是:

发现头文件:a2functional.h 中有类似的定义,于是在 bignum.h 中引用该头文件 #include “a2functional.h”,结果仍然失败;

4.既然不能引用头文件,能不能把声明直接拿过来用呢?试一下不就知道了吗,搞起来,于是将a2functional.h中关于make_unique部分的声明拿了一份到bignum.h中,改成如下图(#if ………………#endif 部分):

重新make,奇迹发生了——成功!

问题解决!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值