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.
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.
Command used to cross compile with objcopy
i586-mingw32msvc-objcopy --input binary --output=pe-i386 --binary-architecture i386 images/HD44780.bmp HD44780_bmp.o
Resulting error at linking stage
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'
The macros I have in my code to access the data
extern char _binary_images_HD44780_bmp_start, _binary_images_HD44780_bmp_end;
#define HD44780_DATA ((void *) &_binary_images_HD44780_bmp_start)
#define HD44780_SIZE ((size_t) (&_binary_images_HD44780_bmp_end - &_binary_images_HD44780_bmp_start))
Supported formats by i586-mingw32-objcopy
me@mypc:~/ > 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
Im trying to compile to Windows (x86). The machine im compiling with is Linux (x86).