title: how to solve this[warning: ignoring file, file was built for unsupported file format]
body: <p>I got some sample code which is used to do a recursive listing of all files and directories in a FAT12 disk image file from my lecturer.</p>
  
  <p>I follow the instructions carefully but get some strange error msg like this:  </p>
  
  <pre><code>ld: warning: ignoring file floppy.img, file was built for unsupported file format
  (0xEB 0x3C 0x90 0x42 0x53 0x44 0x20 0x20 0x34 0x2E 0x34 0x00 0x02 0x01 0x01 0x00 ) 
  which is not the architecture being linked (x86_64): floppy.img
  Undefined symbols for architecture x86_64:
    "_check_bootsector", referenced from:
         _main in dos_ls-LKA1e2.o
    "_cluster_to_addr", referenced from:
         _follow_dir in dos_ls-LKA1e2.o
    "_get_fat_entry", referenced from:
    _     follow_dir in dos_ls-LKA1e2.o
    "_mmap_file", referenced from:
          _main in dos_ls-LKA1e2.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p><strong>gcc ./dos_ls.c floppy.img</strong>  is the command I use in terminal.
  dos_ls.c is the c file, floppy.img is the sample img he gave us.</p>
  
  <p>I believe something wrong with ths format of this img?<br>
  Could anyone explain this error and tell me how to fix it please?</p>
  
  <p>Update: <strong>For example “./dos_ls floppy.img” would list all the files and directories in the disk image file called floppy.img.</strong> this is the instruction i am given. anything wrong with what I am doing?</p>
  
  <p><strong>gcc ./dos_ls.c</strong> gives this error msg:  </p>
  
  <pre><code> Undefined symbols for architecture x86_64:
    "_check_bootsector", referenced from:
        _main in dos_ls-xHY6F1.o
    "_cluster_to_addr", referenced from:
        _follow_dir in dos_ls-xHY6F1.o
    "_get_fat_entry", referenced from:
        _follow_dir in dos_ls-xHY6F1.o
    "_mmap_file", referenced from:
        _main in dos_ls-xHY6F1.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p><strong>gcc --version</strong>  </p>
  
  <pre><code>Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-
  include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  Target: x86_64-apple-darwin13.0.0
  Thread model: posix
  </code></pre>
  
  <p>Update:
  <strong>gcc -o hello dos_ls.c dos.c</strong> create a new file in current directory:  </p>
  
  <pre><code>Usage: dos_ls &lt;imagename&gt;
  logout
  
  [Process completed]
  </code></pre>
  
  <p>What is the correct way to execute this...??</p>