Menu
Forums
Login | Register

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

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 :

scanf("%f",&(emp[0].basic));

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;
}employee;

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

Regards,
Grant
Hi,

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;
forcefloat(&f);
}

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.

Source: http://www.faqs.org/faqs/msdos-programmer-faq/part2/section-5.html

Regards,
Grant

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

Links