marcus905 / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Linker gives errors with the quick_start_examples #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the compilation  command included in the quick_start_examples files 
inside the examples/doc folder

What is the expected output? What do you see instead?
I expect a successful compilation. I instead get an error list from the linker

What version of the product are you using? On what operating system?
1.7.0 RC2 under ubuntu 12.04 and 12.10

Please provide any additional information below.
I solved as follows:
instead of compiling with the suggested command which is:
gcc -o quick_start_example1 -lnfc  quick_start_example1.c

I compiled with the following command:
gcc -o quick_start_example1  quick_start_example1.c -lnfc 

I would suggest to insert this new command into the quick_start_examples files

Original issue reported on code.google.com by lark...@gmail.com on 23 Jan 2013 at 2:17

GoogleCodeExporter commented 9 years ago
I cannot reproduce the problem.

What is the error message you get?
What operating system do you use?

Original comment by ludovic....@gmail.com on 23 Jan 2013 at 5:37

GoogleCodeExporter commented 9 years ago
I'm using ubuntu 12.04 and gcc 4.6.3 and that's the error I get:

gcc -o quick_start_example1 -lnfc   quick_start_example1.c 
/tmp/ccli4628.o: In function `main':
quick_start_example1.c:(.text+0x8c): undefined reference to `nfc_init'
quick_start_example1.c:(.text+0x91): undefined reference to `nfc_version'
quick_start_example1.c:(.text+0xd2): undefined reference to `nfc_open'
quick_start_example1.c:(.text+0x110): undefined reference to 
`nfc_initiator_init'
quick_start_example1.c:(.text+0x128): undefined reference to `nfc_perror'
quick_start_example1.c:(.text+0x141): undefined reference to 
`nfc_device_get_name'
quick_start_example1.c:(.text+0x183): undefined reference to 
`nfc_initiator_select_passive_target'
quick_start_example1.c:(.text+0x277): undefined reference to `nfc_close'
quick_start_example1.c:(.text+0x286): undefined reference to `nfc_exit'
collect2: ld returned 1 exit status

As I said if I compile with this command everything works:
gcc -o quick_start_example1   quick_start_example1.c -lnfc

Here you find a thread where there are people experiencing a problem like my 
one. Don't consider the last post, that's mine and I don't know if it solved 
the problem of the others as well:

http://www.libnfc.org/community/topic/751/unable-to-compile/

Original comment by lark...@gmail.com on 23 Jan 2013 at 7:05

GoogleCodeExporter commented 9 years ago
I tried to search the web for differences between gcc 4.6 and 4.4 and I found 
this thread:
http://askubuntu.com/questions/202166/differences-in-compiling-between-gcc-4-4-a
nd-gcc-4-6

It seems that there are differences in gcc 4.6 and gcc 4.4. I didn't find 
anything official confirming this thesis.

Original comment by lark...@gmail.com on 23 Jan 2013 at 9:33

GoogleCodeExporter commented 9 years ago
Fixed in 109d4962227f

Original comment by ludovic....@gmail.com on 25 Jan 2013 at 1:22

GoogleCodeExporter commented 9 years ago
This issue was closed by revision cd2b03a08a4f.

Original comment by romu...@libnfc.org on 29 Jan 2013 at 11:11

GoogleCodeExporter commented 9 years ago
Sorry, wrong commit log: this issue was closed in 109d4962227f.

Original comment by romu...@libnfc.org on 29 Jan 2013 at 11:13