我在 github 上的 libnfc 项目上使用:
当我尝试编译这个文件时
https://github.com/nfc-tools/libnfc/blob/master/examples/pn53x-diagnose.c
我收到错误 undefined reference to pn53x_transceive'
上线106+117线
为什么?第 53 行是#include "libnfc/chips/pn53x.h"
并在此文件上:
https://github.com/nfc-tools/libnfc/blob/master/libnfc/chips/pn53x.h
我有这个函数(第305行):
int pn53x_transceive(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRxLen, int timeout);
请问我能做什么? 谢谢!
最佳答案
您知道声明 pn53x_transceive
函数接口(interface)的头文件。现在您需要找出哪个文件包含该函数的实现,并将该文件(可能是一个库)链接到您的可执行文件。
关于c - 未定义的引用 C 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44835419/