我正在尝试使用:
http://nfc-tools.org/index.php?title=Nfc-eventd 和 https://code.google.com/p/libfreefare/
创建一个使用这两个代码的新程序。
我从mifare-classic-read-ndef.c
(来自 libfreefare)复制和粘贴代码开始nfc-eventd.c
,当我运行时,make
我得到了预期的错误:
...
make[3]: Entering directory `/home/kapcom01/temp/nfc-eventd/src'
CCLD nfc-eventd
nfc-eventd.o: In function `main':
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:380: undefined reference to `freefare_get_tags'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:387: undefined reference to `freefare_get_tag_type'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:395: undefined reference to `freefare_get_tag_uid'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:398: undefined reference to `freefare_get_tag_friendly_name'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:407: undefined reference to `mifare_classic_connect'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:470: undefined reference to `freefare_free_tags'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:414: undefined reference to `mad_read'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:418: undefined reference to `mad_nfcforum_aid'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:418: undefined reference to `mifare_classic_nfcforum_public_key_a'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:418: undefined reference to `mifare_application_read'
/home/kapcom01/temp/nfc-eventd/src/nfc-eventd.c:422: undefined reference to `tlv_decode'
collect2: error: ld returned 1 exit status
make[3]: *** [nfc-eventd] Error 1
make[3]: Leaving directory `/home/kapcom01/temp/nfc-eventd/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/kapcom01/temp/nfc-eventd/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kapcom01/temp/nfc-eventd'
make: *** [all] Error 2
显然我必须以某种方式链接freefare.h
libreefare 的所有其他源文件,但我不知道如何..
只是#include "freefare.h"
将文件复制粘贴到同一目录中是行不通的。