How to make ld generate error on missing symbols
Posted: Mon Oct 08, 2018 12:25 pm
Hello,
first of all I hope this is not a duplicated topic; I have searched before posting, but I may have missed something.
I'm using ChibiStudio preview 20, and the reported behaviour is valid both for GCC 5.4 and GCC 7.0.
If I do not include in the Makefile a particular source file of my project that, for example, contains declaration and definition of funcion foo(), at compile time I get the warning:
src/main.c:214:44: warning: implicit declaration of function 'foo' [-Wimplicit-function-declaration]
and this is reasonable, since no declaration is found
However, at link-time ld does not complain at all.
Is there any option for gcc or ld that can be passed in order to have the linking phase exit with an error in case of unresolved symbols (or, alternatively, to print out a list of all unresolved symbols) ?
Thank you in advance.
Alberto
first of all I hope this is not a duplicated topic; I have searched before posting, but I may have missed something.
I'm using ChibiStudio preview 20, and the reported behaviour is valid both for GCC 5.4 and GCC 7.0.
If I do not include in the Makefile a particular source file of my project that, for example, contains declaration and definition of funcion foo(), at compile time I get the warning:
src/main.c:214:44: warning: implicit declaration of function 'foo' [-Wimplicit-function-declaration]
and this is reasonable, since no declaration is found
However, at link-time ld does not complain at all.
Is there any option for gcc or ld that can be passed in order to have the linking phase exit with an error in case of unresolved symbols (or, alternatively, to print out a list of all unresolved symbols) ?
Thank you in advance.
Alberto