| ||||||||
Technical Support Support Resources Product Information | BL51: UNRESOLVED EXTERNAL SYMBOL FOR MATH AND FP ROUTINESInformation in this article applies to:
SYMPTOMSI have written the following code:
#pragma SRC
void main(void)
{
volatile unsigned long x = 6367332, y = 47332, z;
z = x * y;
while(1);
}
Without the #pragma SRC, the file compiles and links just fine. With the #pragma SRC, it fails to link. I get the following: WARNING 1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ?C?LMUL WARNING 2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?C?LMUL What does it mean and how do I fix it? CAUSEIn order to perform the long multiplication, a pre-written library routine called ?C?LMUL is used and is linked in from a library file stored in the C51\LIB folder. When you convert your C code to assembler and assemble it, the linker cannot automatically find the routine in the correct library file. The same problem arises for the other math and floating point library routines (not to be confused with library functions such as sqrt). This problem can easily be identifed as all the library routine symbols start with '?C?'. RESOLUTIONYou need to explicitly include the correct library file in your project. Below is a list of all the library files that may be found in the C51\LIB folder and their function. Depending on what you are doing and which memory model you are using, you can work out which files to include.
In the example given above, if the Small memory model was being used then the library file C51S.LIB would be added to the project. MORE INFORMATION
SEE ALSO
Last Reviewed: Friday, July 15, 2005 | |||||||
| ||||||||