We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi
I have a very simple code (see below linker warning) and I get following linker warning. Im working with the Silicon Laboratories IDE. How can I solve this problem? What do I have to change? Do you need more information?
Kind Regards Peter (
BL51 BANKED LINKER/LOCATER V5.15 - SN: Cygnal_8051Fxxx COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2004 D:\SiLabs\pause\main.obj TO D:\SiLabs\pause\main RS(256) PL(68) PW(78) IX
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _PAUSE MODULE: D:\SILABS\PAUSE\MAIN.OBJ (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _PAUSE MODULE: D:\SILABS\PAUSE\MAIN.OBJ (MAIN) ADDRESS: 0014H
****************************************************************************** * RESTRICTED VERSION WITH 1000H BYTE CODE SIZE LIMIT; USED: 0016H BYTE ( 0%) * ******************************************************************************
Program Size: data=9.0 xdata=0 code=22 LINK/LOCATE RUN COMPLETE. 2 WARNING(S), 0 ERROR(S)
// main.c #include "pause.h"
void main(void){ pause(100); }
-----------------
// Pause.h #ifndef PAUSE_H //Includeguard #define PAUSE_H void pause(int x); #endif //PAUSE_H
-------------------
// Pause.c #include "pause.h" void pause(int x){ int i; for (i=0; i<x; i++){} }
The Linker Manual gives descriptions of all the error & warning messages:
http://www.keil.com/support/man/docs/bl51/bl51_l1.htm
http://www.keil.com/support/man/docs/bl51/bl51_l2.htm
As is often the case, these two messages are both the result of the same underlying problem - so, fix that one problem, and you will fix both messages...
Hi, Thanks for your answer.
Yes, I already checked this out this manual. The following causes are mentioned in there:
> The function or variable name may be wrong. > The function or variable may not be declared. > The function or variable may not be public. > The necessary library may not be included. non of them seem to be the problem in my little example.
Kind Regards Peter
The necessary MODULE may not be included.
the M51 file will show you what is linked, have a look.
Erik
Hi Erik
Thanks for your answer. That was the reason why it did not work. I saw that only the "main" is linked. The "pause.obj" was complied but not linked. So I needed to add the file manually (under Project Build Definitions / Files to Link). Now it works just fine.
Have a nice day. Regards Peter
"The "pause.obj" was complied but not linked."
Aha: so, as far as the Linker was concerned, it had no definition of 'pause' - which is the 2nd of the reasons quoted from the manual.
"So I needed to add the file manually (under Project Build Definitions / Files to Link)."
Sounds like a pretty clunky "IDE" if you have to do that manually - not very "Integrated" at all!
Hi Andy
yes, your right, but I thought that the IDE will link this file beause I included it in the main.c. ...well however.
by the way, you're right again...this "IDE" IS very clunky...shame on Silabs ;-)
by the way, you're right again...this "IDE" IS very clunky...shame on Silabs not very important, it would be far nore important that the components of the IDE (case in point the debugger) were bug free. Any competent developer can work without being an IDEiot, none can work (efficiently) with buggy tools.