Undefined references during link


I have trouble linking a project compiled with GCC (MicroEJ Architecture flopi7G25).

At the linking step I have the following errors:

SOAR.o:(.text.__icetea__virtual__com_is2t_microjvm_mowana_VMTask___getExitCode+0x6): undefined reference to com_is2t_microjvm_mowana_VMTask___getExitCode' SOAR.o:(.text.__icetea__virtual__com_is2t_microjvm_mowana_VMTask___initialize+0x6): undefined reference to com_is2t_microjvm_mowana_VMTask___initialize’
SOAR.o:(.text.__icetea__virtual__com_is2t_microjvm_mowana_VMTask___start__ILiceTea_lang_Ram_2+0x6): undefined reference to `com_is2t_microjvm_mowana_VMTask___start’

Where should these functions be defined? I have already added the microejruntime.a and microejapp.o libraries.




This error most likely occurs because microejruntime.a refers to symbols in microejapp.o but is declared after in the linker command line. By default, the GNU LD linker does not search unresolved symbols into archive files loaded previously (see man ld for a description of the start-group option). To solve this issue, either invert the declaration of the libraries (put microejapp.o first) or guard the libraries declaration with --start-group and --end-group in the linker command line invocation.

You can find an example of --start-group and --end-group usage in Create a MicroEJ Firmware From Scratch — MicroEJ Documentation

Great thanks!

I changed the order of the libraries and I no longer have these errors.