Login | Register

Home > Forums > C++ > Floating point formats not linked Page :  1 
Floating point formats not linked

I have received an e-mail from a person who is getting the following error :

"floating point formats not linked Abnormal program termination"

while trying to enter text using scanf and the Turbo C compiler.

The line of code causing the problem is :


The emp array is declared as follows :

employee emp[3];

and the struct is defined as follows :

typedef struct
char ecode[5],name[10];
float basic,hra,net;

If anyone has experienced a similar problem, could they please post their thoughts here.


I have just looked around the web and have found the following solution :

"Floating point formats not linked" is a Borland run-time error (Borland C or C++, Turbo C or C++). Borland's compilers try to be smart and not link in the floating- point (f-p) library unless you need it. Alas, they all get the decision wrong. One common case is where you don't call any f-p functions, but you have %f or other f-p formats in scanf() or printf() calls. The cure is to call an f-p function, or at least force one to be present in the link.

To do that, define this function somewhere in a source file but don't call it:

static void forcefloat(float *p)
float f = *p;

It doesn't have to be in the module with the main program, as long as it's in a module that will be included in the link.



Home > Forums > C++ > Floating point formats not linked Page :  1 

You need to be logged in to reply to this topic.

All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005

Read the Disclaimer