I'm using the OpenWrt toolchain to build a C++ application, which makes use of a C library but I doubt that's relevant.
I have two files file.h
(which contains a C++ class along with the implementation) and main.cpp
which makes use of that class.
First I tried creating an object from file.h
mipsel-linux-g++ -Wall -c -Ipath_to/staging_dir_mipsel/include -Ipath_to/staging_dir_mipsel/usr/incude file.h -o file.o
Which gives no error and creates the object file. I do the same thing with main.cpp
but had issues with linking them together.
When I run
mipsel-linux-readelf -h main.o
It returns the header of the elf object
When I run
mipsel-linux-readelf -h file.o
It returns
readelf: Error: Unable to read in 0x2d78 bytes of section headers
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
Any pointers? :)