我正在使用 'TPCircularBuffer' 类来创建一个循环缓冲区对象,来自这个网站。这是我当前的代码:
TPCircularBufferRecord bufferRecord; //1
TPCircularBufferInit(&bufferRecord, kBufferLength); //2
第 1 行工作正常,这意味着链接器已找到该类的 .cpp 和 .h 文件。但是,第 2 行无法编译,并出现错误:
Undefined symbols:
"TPCircularBufferInit(TPCircularBufferRecord*, int)", referenced from:
StereoEffect3::StereoEffect3(ComponentInstanceRecord*)in StereoEffect3-1DB483EC8D75827.o
StereoEffect3::StereoEffect3(ComponentInstanceRecord*)in StereoEffect3-1DB483EC8D75827.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
我不认为这是原始源代码的问题,但无论如何我都会将其包含在此处: TPCircularBuffer.c
有谁知道为什么链接器/编译器找不到函数 TPCircularBufferInit?TPCircularBufferInit函数如下:
inline void TPCircularBufferInit(TPCircularBufferRecord *record, int length) {
record->head = record->tail = record->fillCount = 0;
record->length = length;
}
我很确定我正在将正确类型的参数传递给它......