title: Cross compiling for windows. Objcopy appears to be giving bad object file
body: <p>I have a program I originally wrote in linux which uses objcopy to embed some images within the executable to be used at runtime. I have no problems with this in linux at all and it runs fine.</p>
  
  <p>However when I try and cross compile the program for windows, I get a list of undefined references at the linking stage, suggesting to me objcopy is failing. Could someone please point me in the right direction to get this to cross compile correctly. I know this is not a code problem as the code is portable.</p>
  
  <p>Command used to cross compile with objcopy</p>
  
  <pre><code>i586-mingw32msvc-objcopy --input binary --output=pe-i386 --binary-architecture i386 images/HD44780.bmp HD44780_bmp.o
  </code></pre>
  
  <p>Resulting error at linking stage</p>
  
  <pre><code>HDxx780.o:HDxx780.cpp:(.text+0xbe2): undefined reference to `__binary_images_HD44780_bmp_end'
  HDxx780.o:HDxx780.cpp:(.text+0xbef): undefined reference to `__binary_images_HD44780_bmp_start'
  HDxx780.o:HDxx780.cpp:(.text+0xc04): undefined reference to `__binary_images_HD44780_bmp_start'
  </code></pre>
  
  <p>The macros I have in my code to access the data</p>
  
  <pre><code>extern char _binary_images_HD44780_bmp_start, _binary_images_HD44780_bmp_end;
  
  #define HD44780_DATA ((void *) &amp;_binary_images_HD44780_bmp_start)
  #define HD44780_SIZE ((size_t) (&amp;_binary_images_HD44780_bmp_end - &amp;_binary_images_HD44780_bmp_start))
  </code></pre>
  
  <p>Supported formats by i586-mingw32-objcopy</p>
  
  <pre><code>me@mypc:~/ &gt; i586-mingw32msvc-objcopy --info
  BFD header file version (GNU Binutils) 2.20
  pe-i386
  (header little endian, data little endian)
    i386
  pei-i386
  (header little endian, data little endian)
    i386
  elf32-i386
  (header little endian, data little endian)
    i386
  elf32-little
  (header little endian, data little endian)
    i386
  elf32-big
  (header big endian, data big endian)
    i386
  srec
  (header endianness unknown, data endianness unknown)
    i386
  symbolsrec
  (header endianness unknown, data endianness unknown)
    i386
  verilog
  (header endianness unknown, data endianness unknown)
    i386
  tekhex
  (header endianness unknown, data endianness unknown)
    i386
  binary
  (header endianness unknown, data endianness unknown)
    i386
  ihex
  (header endianness unknown, data endianness unknown)
    i386
  
        pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec 
        i386 pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec 
  
        symbolsrec verilog tekhex binary ihex 
        i386 symbolsrec verilog tekhex binary ihex 
  </code></pre>
  
  <p>Im trying to compile to Windows (x86).
  The machine im compiling with is Linux (x86).</p>