-1

I use on libnfc project on github:

when i try to compile this file

https://github.com/nfc-tools/libnfc/blob/master/examples/pn53x-diagnose.c

i got error of undefined reference to pn53x_transceive'

on line 106+117

why? on line 53 it do #include "libnfc/chips/pn53x.h" and on this file: https://github.com/nfc-tools/libnfc/blob/master/libnfc/chips/pn53x.h i have this function (line 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);

what can i do please? thanks!

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
  • Looks like you are missing `topn53x_transceive` function. Is it included in project on Github somewhere? – unalignedmemoryaccess Jun 29 '17 at 21:40
  • @tilz0R i edit ..please read again ',I include the file pn53x.h and there is the function – SGFSGFDGFDG Jun 29 '17 at 21:44
  • 1
    Read [ask] and provide all required information **in the question itself**! – too honest for this site Jun 29 '17 at 22:02
  • Maybe the loader/linker doesn't know where to find it? – wildplasser Jun 29 '17 at 22:05
  • Although the duplicate is for C++ rather than C, the basic ideas apply. Using a header declares things; you have to provide a library to get the definition of functions and variables declared in headers. (There's a standard library that provides a lot of standard functions that is linked automatically; for functions not in that library, you need to add the alternative to the linking command line — after the object (or source) files.) – Jonathan Leffler Jun 29 '17 at 23:00

1 Answers1

0

You know the header file which declares the interface to the pn53x_transceive function. Now you need to find out which file contains that function's implementation, and link that file (it might be a library) to your executable.

ndim
  • 35,870
  • 12
  • 47
  • 57