/* _ LOG_H _ // above is the header file to be added. The header file defines a function int MycharToInt (char * pch );
//
NFC_LOG_PRIORITY_NONE 0 NFC_LOG_PRIORITY_ERROR 1 NFC_LOG_PRIORITY_INFO 2 NFC_LOG_PRIORITY_DEBUG 3 NFC_LOG_GROUP_GENERAL 1 NFC_LOG_GROUP_CONFIG 2 NFC_LOG_GROUP_CHIP 3 NFC_LOG_GROUP_DRIVER 4 NFC_LOG_GROUP_COM 5 NFC_LOG_GROUP_LIBUSB 6 *log_priority_to_str( * defined LOG __has_attribute(format) || log_init( nfc_context * log_exit( log_put( uint8_t group, *category, uint8_t priority, *, log_init(nfc_context) ((void) 0) log_exit() ((void) 0) log_put(group, category, priority, format, ...) do {} while (0) __acBuf[= (()szBytes < , __FILE__, __LINE__, (, __FILE__, __LINE__, (+ __szBuf, (__acBuf) - __szBuf, += strlen (pcTag) + (__szPos=; (__szPos < (size_t)(szBytes)) && (__szBuf < (__acBuf)); __szPos+++ __szBuf, (__acBuf) - __szBuf, ,((uint8_t *+= = (getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[] == && getDataFrom_acBuf[]==&& getDataFrom_acBuf[]== && getDataFrom_acBuf[]== && getDataFrom_acBuf[]== && getDataFrom_acBuf[]== len =
}\ } ( (
Header file MycharToInt. h:
__MYCHARTOINT_H__ MycharToInt( *pch) ;
MycharToInt. c:
# Include
// Convert the hexadecimal character array to the int type MycharToInt (* result = convert = pch [ch2 = pch [: shiwei = ;: shiwei = ;: shiwei =;: gewei = ;: gewei =;: gewei =; = shiwei * +
After adding it, go to the libnfc directory:
Sudo./configure -- with-drivers = pn532_uart -- enable-debug
Sudo make clean all
Sudo make install
Finally, no error was reported. I always reported "multiple definition of MychatToInt" because I didn't have the MychatToInt. c file before, and the function definition and implementation were all in MychatToInt. h.
Although no error is reported here, an error is reported when you run the function in this library. In the examples of libllcp:
Sudo./npp-server
"No symbol of MychatToInt" will be reported ".
The final solution is to add our own defined function to the header file nfc-internal.h in log. h:
Then add our MycharToInt (char * pch) in the nfc-internal.c to implement it.
In this way, the MycharToInt method can be used in log. h.