我在 memory.c 的 get_metadata_record_new(sz) 上得到“未定义的对 `get_metadata_record_new' 的引用”
{内存.c}
#include "metadata_record.h"
bool add_tohashtable(struct memory *mem, char *key_address, size_t sz) {
//Getting the error on this next line
struct metadata_record * metarec = get_metadata_record_new(sz);
...
}
{metatdata_record.h}
#ifndef METADATA_H_
#define METADATA_H_
struct metadata_record {
size_t size;
bool allocated;
};
struct metadata_record *get_metadata_record_new(size_t);
...
#endif /* METADATA_H_ */
我尝试将此定义从 metadata_record.c 文件复制并粘贴到 memory.c 的顶部,错误消失了:
struct metadata_record *get_metadata_record_new(size_t sz) {
...
}