Link error L1822 what is that?

Showing results for 
Search instead for 
Did you mean: 

Link error L1822 what is that?

Contributor I

I'm trying to make a CW project mixing C with asm ,and the following error always appear when debugging:

Link error L1822 symbol  _FSFLOAT in Tcp_demo.c.o is undefined..

the problem is that I don't find this (_FSFLOAT) in the file Tcp_demo.c at all!!

also there're other three errors including symbols _FDIV, _FSTRUNC which are also in the same file (Tcp_demo.c.o) while I don't find them in this file and I also i don't know them or ever met them before?!!!!

Please help me I don't understand what to do!!

Labels (1)
0 Kudos
3 Replies

Specialist III
_FSFLOAT is a run time function used by the compiler to convert a long variable to a float.
If you are using floating point arithmetic in your application you have to add the appropriate ANSI library file to your application.
ANSI library file to use depends on the compiler option you are using to build the application.
If you are using CW HC12 you find a list of available library file and when to use it in the {Install\\lib\hc12c\readme.txt
If you are using  CW HC08 you find a list of available library file and when to use it in the {Install\\lib\hc08c\readme.txt
_FDIV and _FSTRUNC are other run time functions, which are also implemented in the library.
Note that if you create your project using the project wizard, if you specify you are programming in C and you want to use floating points, the appropriate library file will be added to the project automatically.
I hope this helps.
0 Kudos

Contributor I

thank your very much!, you seems to touch the problem exactly..

really, in the project wizard I unhappily chose floating point format supported to be NONE!!!

it seems that in program calculations the compiler needed this real time functions but didn't find them..

I tried to insert math.h but the same error occurs!

I want to keep my project and not creating a new one, it's very hard for me!, I also want to know how to insert libraries properly e.g how to insert math library in steps??

Another question, and execuse me for my questions storm as I'm a beginner in both CW and C programming!, How to take square roots for two added squared one byte variables (i always define them as char ) i.e char a;

                                         char b;

                       char c=sqrt(a*a+b*b);

I knew that sqrt only works for double (may be i'm wrong), but how to use it here????????

by the way this is the core of my first problem!!

Thanx in advance :smileyhappy:

0 Kudos

Specialist I
If I'm reading your post correctly, you need to add the library file with floating-point support as well as the header file. You need to go to the libs directory and look for something like ansif.lib. In CodeWarrior, go to the Project window (it has all of the filenames and some tabs at the top), and right-click. Pick Add Files... from the drop-down menu that appears. Navigate to the libs directory (it's in the same parent directory as the header files directory) and choose the appropriate library file. Click Open to add the file, and it's filename should appear in the project window. You may be prmopted as to which target to add the file to, and I'd suggest adding to all of the targets for now.

0 Kudos