Reputation: 204
I want to bind member function, but it seems failed.
Q4kDeviceSource.hh
class Q4kDeviceSource {
public:
void videoStreamCallback(QIPCamStreamCbType streamCbType, uint32_t streamId, uint8_t *buffer, size_t bufferSize);
。。。
}
typedef std::function<void(QIPCamStreamCbType cbType, uint32_t streamId,
uint8_t* buffer, size_t bufferSize)>
StreamCallback;
Q4kDeviceSource.cpp
。。。
StreamCallback videoElementryCb = std::bind(&Q4kDeviceSource::videoStreamCallback, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
videoElementryCb(QIPCamStreamCbType::QIPCAM_STREAMCBTYPE_NORMAL,id,NULL,0);
。。。
build failed!
./prebuilts/ndk/9/sources/cxx-stl/gnu-libstdc++/4.8/include/functional:2463: error: undefined reference to 'std::__throw_bad_function_call()' collect2: error: ld returned 1 exit status
Upvotes: 1
Views: 241
Reputation: 136515
Looks like you link with gcc
instead of g++
.
The difference is that g++
also links in libstdc++
, whereas gcc
does not.
Either link with g++
or add -lstdc++
to your linker command line.
Upvotes: 1