Topic: Linker Error?

Hey Guys,
I am quite new to libnfc and I am currently trying to compile the precoded example nfc-poll.c - which isn't working. (undefinded Ref.)
That's why I assume it is a linking error although I set all linking directorys in the compiler settings of my IDE (Codeblocks) and set the compiler flag -lnfc.

Error log:
/root/libnfc-1.7.1/examples/nfc-poll.o||In function `stop_polling':|
nfc-poll.c|| undefined reference to `nfc_abort_command'|
nfc-poll.c|| undefined reference to `nfc_exit'|
/root/libnfc-1.7.1/examples/nfc-poll.o||In function `main':|
nfc-poll.c|| undefined reference to `nfc_version'|
nfc-poll.c|| undefined reference to `nfc_init'|
nfc-poll.c|| undefined reference to `nfc_open'|
nfc-poll.c|| undefined reference to `nfc_exit'|
nfc-poll.c|| undefined reference to `nfc_initiator_init'|
nfc-poll.c|| undefined reference to `nfc_perror'|
nfc-poll.c|| undefined reference to `nfc_close'|
nfc-poll.c|| undefined reference to `nfc_exit'|
nfc-poll.c|| undefined reference to `nfc_device_get_name'|
nfc-poll.c|| undefined reference to `nfc_initiator_poll_target'|
nfc-poll.c|| undefined reference to `nfc_perror'|
nfc-poll.c|| undefined reference to `nfc_close'|
nfc-poll.c|| undefined reference to `nfc_exit'|
nfc-poll.c|| undefined reference to `print_nfc_target'|
nfc-poll.c|| undefined reference to `nfc_initiator_target_is_present'|
nfc-poll.c|| undefined reference to `nfc_perror'|
nfc-poll.c|| undefined reference to `nfc_close'|
nfc-poll.c|| undefined reference to `nfc_exit'|
||=== Build finished: 20 errors, 0 warnings ===|

I hope you can help me.
Thank you in advance,
Raavgo

Re: Linker Error?

How do you install libnfc ?
For me, like it  :

Install the software pack needed

sudo apt-get update
sudo apt-get install libusb-dev libpcsclite-dev

Download and compress source code pack of libnfc

cd ~
wget [url]http://dl.bintray.com/nfc-tools/sources/libnfc-1.7.1.tar.bz2[/url]
tar -xf libnfc-1.7.1.tar.bz2

Compile and install

cd libnfc-1.7.1
./configure --prefix=/usr --sysconfdir=/etc  #En développement --enable-debug
make
sudo make install 

Modify configuration file

cd /etc
sudo mkdir nfc
sudo mkdir -p /etc/nfc/devices.d

sudo nano /etc/nfc/libnfc.conf
Copy and paste the following contents to file /etc/nfc/libnfc.conf:
# Allow device auto-detection (default: true)
# Note: if this auto-detection is disabled, user has to set manually a device
# configuration using file or environment variable
allow_autoscan = true

# Allow intrusive auto-detection (default: false)
# Warning: intrusive auto-detection can seriously disturb other devices
# This option is not recommended, user should prefer to add manually his device.
allow_intrusive_scan = false

# Set log level (default: error)
# Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug)
# Note: if you compiled with --enable-debug option, the default log level is "debug"
log_level = 1

# Manually set default device (no default)
# To set a default device, you must set both name and connstring for your device
# Note: if autoscan is enabled, default device will be the first device available in device list.
device.name = "Itead_PN532_I2C"
device.connstring = " pn532_i2c:/dev/i2c-1"

With this guide, nfc-poll is ready (compiled during libnfc installation).

Re: Linker Error?

Hi,

Please read README files, and dedicated tutorials...
http://nfc-tools.org

Romuald Conty