title: Undefined reference errors in gcc when compiling on another machine
body: <p>I wrote a program (myreader.c) to manipulate a RFID reader.</p>
  
  <p>I compile by type "make" in the root of the package, makefile is shown below</p>
  
  <pre><code>  # CC and CFLAGS are varilables 
    CC=gcc
    CFLAGS = -c
    # -c option ask g++ to compile the source files, but do not link.
    # -g option is for debugging version
    # -O2 option is for optimized version
    OPTFLAGS = -O2 -g
  
    myreader    : src/myreader.c
            $(CC) $(OPTFLAGS) src/myreader.c src/crypto1.c src/nfc-utils.c -lnfc -o ./bin/myreader 
  
    # clean all the .o and executable files
    clean:
            rm -rf bin/myreader
  </code></pre>
  
  <p>and it works well on my original machine(64 bits, Ubuntu 12.04 LTS), and the only problem is, when I type make, the warning info would come up. </p>
  
  <pre><code>  src/myreader.c:519:6: warning: conflicting types for ‘printResult’ [enabled by default]
    src/myreader.c:211:3: note: previous implicit declaration of ‘printResult’ was here
  </code></pre>
  
  <p>But /bin/myreader works well.</p>
  
  <hr>
  
  <p>However, when I move the package to another machine(64 bits, Ubuntu 11.10), and type make in the same way as in the original machine.</p>
  
  <p>Error messages in the below appears:</p>
  
  <pre><code>  berln@ubuntu:~/桌面/useful code$ make
    gcc -O2 -g src/myreader.c src/crypto1.c src/nfc-utils.c -lnfc -o ./bin/myreader
    src/myreader.c:519:6: warning: conflicting types for ‘printResult’ [enabled by default]
    src/myreader.c:211:3: note: previous implicit declaration of ‘printResult’ was here
    /tmp/ccrKvhjm.o: In function `mf_enhanced_auth':/home/berln/桌面/useful code/src/myreader.c:373: undefined reference to `nfc_configure'
    /home/berln/桌面/useful code/src/myreader.c:380: undefined reference to `nfc_configure'
    /home/berln/桌面/useful code/src/myreader.c:390: undefined reference to `nfc_configure'
    /home/berln/桌面/useful code/src/myreader.c:434: undefined reference to `nfc_configure'
    /tmp/ccrKvhjm.o: In function `mf_configure':
    /home/berln/桌面/useful code/src/myreader.c:484: undefined reference to `nfc_configure'
    /tmp/ccrKvhjm.o:/home/berln/桌面/useful code/src/myreader.c:489: more undefined references to `nfc_configure' follow
    /tmp/ccrKvhjm.o: In function `main':
    /home/berln/桌面/useful code/src/myreader.c:155: undefined reference to `nfc_connect'
    /home/berln/桌面/useful code/src/myreader.c:213: undefined reference to `nfc_disconnect'
    collect2: ld returned 1 exit status
    make: *** [myreader] Error 1
  </code></pre>
  
  <p>I have no ideas why this error happened on only one machine instead of both. </p>
  
  <p><strong>If you need more information, you can download the package <a href="http://homepage.ntu.edu.tw/~b98901160/myreader.tgz" rel="nofollow">here</a>.</strong></p>
  
  <p>Thanks in advance.</p>