Problem with Turbo C++

Art Boyne boyne at hplvli.HP.COM
Thu Oct 4 00:55:00 AEST 1990


ghenniga at nmsu.edu (Gary Hennigan) writes:

>To accomplish this I used this piece of code:
>
>for( nr=1; nr <= Anr; nr++)
>{
>  fscanf( inpfile, "%f\n", &A[nr][1] );
>}
>
>Now everything compiles fine but when I run it I get the following error:
>
> scanf : floating point formats not linked
>Abnormal program terminaion.

This is a known bug in Turbo C: because there are no floating point
operations in the program other that the fscanf/fprintf, the compiler
forgets to tell the linker to include the floating point library stuff.
The solution is to add a dummy (never called) routine such as:

int stupid_turbo_c()
{
  double x = 1.0;
  return (int)x;
}

Art Boyne, boyne at hplvla.hp.com



More information about the Comp.lang.c mailing list