Adding a header file to the libnfc library by yourself is very difficult.

Source: Internet
Author: User



/* _ 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.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.