I am trying to use:
http://nfc-tools.org/index.php?title=Nfc-eventd and https://code.google.com/p/libfreefare/
to create a new program that make use of code from both of these.
I have started with copy and pasting code from mifare-classic-read-ndef.c
(from libfreefare) to nfc-eventd.c
and when I run make
I get the expected errors:
...
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
Obviously I have to link somehow the freefare.h
and all the other source files of libreefare but I cant figure out how..
Just #include "freefare.h"
and copy-paste the files into the same directory didn't work.
-lfreefare
to your link line? – evil otto Jun 27 '13 at 0:22