Hello folks!
I hope that somebody can enlighten me on this:
It is not possible to compile bigger projects using so called "legacy" code, if it implies separate object link stages.
I tried with simplified command lines like this:
gcc -c source.c (compiles fine, object file is written)
gcc -o objectfile -lauto gives
/SDK/newlib/lib/crtbegin.o: In function `_start':
(.text+0x14e): undefined reference to `main'
/SDK/newlib/lib/crtbegin.o: In function `_start':
(.text+0x156): undefined reference to `main'
__USE_INLINE__ is #defined in the source code, btw.
Best bit on this: with
gcc -o executable sourcefile -lauto
all works nice and slick.
Can anybody explain me, why gcc behaves like this?
Another one: If I try to make the project with a makefile, it fails utterly in the linking stage with tons of "undefined reference to...", although linking is done with -lauto and __USE_INLINE__ #define d.
Compiling and linking only works with the basic command line above. Why is it this way? Am I doing something wrong? If so, what??
A more in-deep answer is highly appreciated, thank you very much.
Regards