【问题标题】:Rnnlib installation range errorRnnlib安装范围错误
【发布时间】:2016-03-23 12:37:27
【问题描述】:

我正在通过https://github.com/meierue/RNNLIB安装rnnlib

在安装 boost 和其他并完成其他步骤后,我收到错误-SeqBuffer.hpp:227: error: reference to ‘range’ is ambiguous Helpers.hpp:298: error: candidates are: template<class T> std::pair<boost::iterators::counting_iterator<Incrementable, boost::iterators::use_default, boost::iterators::use_default>, boost::iterators::counting_iterator<Incrementable, boost::iterators::use_default, boost::iterators::use_default> > range(const T&, const T&)

Makefile:223: recipe for target 'DataExporter.o' failed
make[2]: *** [DataExporter.o] Error 1
make[2]: Leaving directory '/home/adminhp/Himaanshu/RNNLIB-master/src'
Makefile:217: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/adminhp/Himaanshu/RNNLIB-master'
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2

【问题讨论】:

    标签: boost makefile installation boost-python recurrent-neural-network


    【解决方案1】:

    using namespace 再次来袭。

    Helpers.hpp 包含以下该死的序列:

    using namespace std;
    using namespace boost;
    using namespace boost::assign;
    using namespace boost::posix_time;
    using namespace boost::gregorian;
    

    坦率地说,在这一点上我会放弃。 尤其是前两行在道德上相当于地毯式轰炸。使用凝固汽油弹。¹

    更新创建a pull request with the changes required to make the code compile

    让问题更加复杂的是,RNNLIB 的 range 设施甚至不在命名空间中......

    所以,结果是range 与 boost 中的命名空间发生冲突。

    消除冲突的最简单方法是将range 的所有循环使用限定为::range...

    附言。稍后会出现equal


    ¹Why is "using namespace std" considered bad practice?

    【讨论】:

    • 我创建了一个拉取请求来解决编译问题:github.com/meierue/RNNLIB/pull/2
    • 我已经做了你提到的改变。但在那之后我收到了这个错误。 Helpers.hpp:在函数'std::pair<:counting_iterator boost::range_difference>::type, boost::use_default, boost::use_default>, boost::counting_iterator::type, boost::use_default, boost::use_default> > indices(const R&)': Helpers.hpp:301: error: expected primary-expression before '(' token
    • 所以你没有应用所有的改变 :)
    • 你的意思是我也应该对“相等”进行更改..?
    • 不。所有的变化。包括 Helpers.cpp 中的那些。以及重新排序。和资格。你知道,只有拉取请求中的 4 次提交。我真的不知道如何比拉取请求更清楚。
    猜你喜欢
    • 2019-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-27
    • 2016-01-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多