【发布时间】:2012-12-22 13:22:53
【问题描述】:
最近我发现 PortAudio 有 C++ 绑定,所以为了保持良好和面向对象,我正在从普通的 PortAudio C 函数转换为 C++ 绑定。但是,我遇到了回调函数的麻烦。 我尝试通过以下方式创建流:
stream = new portaudio::MemFunCallbackStream<OutputChannel>(params, *this, &OutputChannel::output);
此调用是在 OutputChannel 类的方法中进行的。这个相同的类包含应该作为回调函数的方法,因此我将传递给 MemFunCallbackStream 方法的“this”。 但是在构建时,链接器会报错:
Undefined symbols for architecture x86_64:
"_Pa_OpenStream", referenced from:
portaudio::MemFunCallbackStream<OutputChannel>::open(portaudio::StreamParameters const&)in outputchannel.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
我确定 PortAudio 库已加载,因为其他一些(诊断)方法确实有效。 什么可能导致此错误?
【问题讨论】:
-
您确定没有在标头中实现诊断方法吗?
-
是的,标题中没有任何实现。
标签: c++ binding callback portaudio