如何在Ubuntu中编译和修复此绑定错误?

时间:2019-03-20 09:07:36

标签: ubuntu compilation bind

我正在尝试从第三方那里编译一个代码,我知道该代码正在安装了此软件的另一台计算机上工作:

  • CentOS 6 64位
  • gcc具有完整的C ++ 14支持。他们正在使用5.3.1
  • 内核2.6.30
  • glibc 2.12

现在,我有:

  • Ubuntu 18.04.2 LTS
  • gcc(Ubuntu 7.3.0-27ubuntu1〜18.04)7.3.0
  • 内核4.15.0-46-通用#49-Ubuntu
  • ldd(Ubuntu GLIBC 2.27-3ubuntu1)2.27

当我尝试编译下一个时,出现此错误:    Error

+-----+-----------+----------+
+ id  +   date    +   year   +
+-----+-----------+----------+

+-----+-----------+----------+
+ id  +   owner   +   age    +
+-----+-----------+----------+

我认为问题与 bind ubuntu版本有关。有人能帮我吗?谢谢。

这是指向错误部分的代码:

datasource.cpp

src/datasource.cpp: In constructor ‘DataLoop::DataLoop(std::shared_ptr<shaga::INI>, std::shared_ptr<libattach::LocalAttach>)’:
src/datasource.cpp:103:93: error: no matching function for call to ‘libattach::LocalAttach::set_receive_callback(std::_Bind_helper<false, void (DataLoop::*)(std::__cxx11::list<shaga::Chunk>&&), DataLoop*, const std::_Placeholder<1>&>::type)’
  _attach->set_receive_callback (std::bind (&DataLoop::callback, this, std::placeholders::_1));
                                                                                             ^
In file included from /usr/local/include/libattach/common.h:129:0,
                 from /usr/local/include/libattachlite.h:23,
                 from src/internal.h:15,
                 from src/datasource.cpp:6:
/usr/local/include/libattach/localattach.h:156:9: note: candidate: void libattach::LocalAttach::set_receive_callback(libattach::RECEIVE_CALLBACK)
    void set_receive_callback (RECEIVE_CALLBACK func);
         ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/libattach/localattach.h:156:9: note:   no known conversion for argument 1 from ‘std::_Bind_helper<false, void (DataLoop::*)(std::__cxx11::list<shaga::Chunk>&&), DataLoop*, const std::_Placeholder<1>&>::type {aka std::_Bind<void (DataLoop::*(DataLoop*, std::_Placeholder<1>))(std::__cxx11::list<shaga::Chunk>&&)>}’ to ‘libattach::RECEIVE_CALLBACK {aka std::function<void(shaga::Chunk&&)>}’

localattach.h

#include "internal.h"

using namespace shaga;
using namespace libattach;

extern Gfx *_gfx;


void DataLoop::callback (shaga::CHUNKLIST &&clist)
{
    (void) clist;
//  for_each (clist.cbegin (), clist.cend (), [this](const Chunk &chunk) {
//          P::printf ("-> %s chunk '%s', %s, id %" PRIX32 ", ttl %" PRIu8, chunk.get_prio_text ().c_str (), chunk.get_type ().c_str (), chunk.get_trustlevel_text ().c_str (), chunk.get_hwid (), chunk.get_ttl ());
//  });
}

void DataLoop::tick (const uint64_t msec)
{
    P::printf ("tick %" PRIu64, msec);
}

DataLoop::DataLoop (std::shared_ptr<shaga::INI> ini, std::shared_ptr<libattach::LocalAttach> attach) :
    _ini (ini), _attach (attach), _epoll_fd (-1), _gpio_power_status_fd (-1), _gpio_power_control_fd (-1)
{
    _is_signal.store (false);

    _attach->set_receive_callback (std::bind (&DataLoop::callback, this, std::placeholders::_1));
    _attach->set_receive_tick (std::bind (&DataLoop::tick, this, std::placeholders::_1));

0 个答案:

没有答案