目的は、CDevVS890 内で m_callback_fn を呼び出すときに CVS890Executor::do_full_frame を実行することです。
以下は、問題のあるコードです。
"CDevVS890.h"
typedef std::tr1::function<void (void* frame, int len)> DoFrameFn;
class CDevVS890
{
public:
CDevVS890();
void receive();
DoFrameFn m_callback_fn;
}
"CDevVS890.cpp"
void CDevVS890::receive()
{
...
m_callback_fn((void*)frame, (int)len);
}
/*----------------------------------------------------------------------*/
"CVS890Executor.h"
class CVS890Executor
{
public:
CVS890Executor();
private:
void hookup_to_DevVS890();
void do_full_frame( void* frame, int len );
}
"CVS890Executor.cpp"
CVS890Executor::CVS890Executor()
{
hookup_to_DevVS890();
}
void CVS890Executor::hookup_to_DevVS890()
{
m_pDevVS890 = new CDevVS890();
m_pDevVS890->m_callback_fn =
std::tr1::bind(&CVS890Executor::do_full_frame, this, _1);
}
void CVS890Executor::do_full_frame(void* frame, int len)
{
...
}
エラーは複数あり、非常に読みにくいです。
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1/functional:56 からインクルードされたファイルでは、.. /../src/Common/CDevVS890.h:17、CVS890Executor.h:13 から、CVS890Executor.cpp:8 から: /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../.. /../../include/c++/4.4.6/tr1_impl/functional: メンバ関数内 âtypename std::tr1::result_of<_Functor(typename std::tr1::result_of 0)>(_Bound_args, std:: tr1::tuple<_UElements ...>)>::type ...)>::type std::tr1::_Bind<_Functor(_Bound_args ...)>::__call(const std::tr1:: tuple<_UElements ...>&, std::tr1::_Index_tuple<_Indexes ...>) [ with _Args = void*&, int&, int ..._Indexes = 0, 1, _Functor = std::tr1: :_Mem_fn, _Bound_args = CVS890Executor*, std::tr1::_Placeholder<1>]â: /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:1191: âtypename std::tr1::result_of<_Functor(typename std::tr1::result_of 0 からインスタンス化)>(_Bound_args, std::tr1::tuple<_UElements ...>)>::type ...)>::type std::tr1::_Bind<_Functor(_Bound_args ...)>::operator ()(_Args& ...) [ with _Args = void*, int, _Functor = std::tr1::_Mem_fn, _Bound_args = CVS890Executor*, std::tr1::_Placeholder<1>]â /usr/lib/gcc /x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:1668: âstatic void std::tr1::_Function_handler:: からインスタンス化_M_invoke(const std::tr1::_Any_data&, _ArgTypes ...) [ with _Functor = std::tr1::_Bind(CVS890Executor*, std::tr1::_Placeholder<1>)>, _ArgTypes = void*, int ]â /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:2005:âstd::tr1::function<_Res(_ArgTypes ...)>::function(_Functor, typename __gnu_cxx::__enable_if<(! std::tr1::is_integral::value), std::tr1:: からインスタンス化function<_Res(_ArgTypes ...)>::Useless>:: _type) [with _Functor = std::tr1::_Bind(CVS890Executor*, std::tr1::_Placeholder<1>)>, _Res = void, _ArgTypes = void*, int]â /usr/lib /gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:1885: âtypename __gnu_cxx::__enable_if<(! std からインスタンス化::tr1::is_integral::value), std::tr1::function<_Res( ArgTypes ...)>&>::_type std::tr1::function<_Res(_ArgTypes ...)>::operator=(_Functor) [ with _Functor = std::tr1::_Bind(CVS890Executor*, std::tr1::_Placeholder<1>) >, _Res = void, _ArgTypes = void*, int]â CVS890Executor.cpp:115: ここからインスタンス化 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../. ./include/c++/4.4.6/tr1_impl/functional:1137: エラー: â(std::tr1::_Mem_fn) (CVS890Executor*&, void*&)â /usr/lib/gcc/ の呼び出しに一致しませんx86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:546: 注: 候補は次のとおりです: _Res std::tr1::_Mem_fn< _Res (_Class::*)(_ArgTypes ...)>::operator()(_Class&, _ArgTypes ...) const [with _Res = void, _Class = CVS890Executor, _ArgTypes = void*, int] /usr/lib/ gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:551: 注: _Res std::tr1::_Mem_fn<_Res (_Class::*)(_ArgTypes ...)>::operator()(_Class*, _ArgTypes ...) const [with _Res = void, _Class = CVS890Executor, _ArgTypes = void*, int] /usr /lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/tr1_impl/functional:1137: エラー: return-statement with a value, 'void' を返す関数内 make:* [CVS890Executor.o] エラー 1
これの何が問題なのですか?
乾杯