PRB: "Floating-point Support Not Loaded" Error with scanf()

Last reviewed: July 25, 1997
Article ID: Q37507
The information in this article applies to:
  • The C Run-time (CRT) included with: - Microsoft C for MS-DOS, versions 6.0, 6.0a, 6.0ax - Microsoft C for OS/2, versions 6.0, 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0, 1.5 - Microsoft Visual C++ 32-bit Edition, versions 1.0, 2.0, 4.0, 5.0

SYMPTOMS

When an application uses the scanf() function to read a floating-point value from the console into an uninitialized "float" type global variable, an R6002 "floating-point format support not loaded" error occurs. This error also occurs when any formatted input routine is used to read a value.

CAUSE

The compiler does not generate a reference to the __fltused variable that instructs the linker to load the floating-point support module.

RESOLUTION

To work around this problem, initialize the floating-point variable or use the variable in an expression in the routine that contains the scanf() call.

STATUS

This behavior is expected. To minimize the size of the executable file, the compiler loads floating-point support only when it is required.

MORE INFORMATION

When a module uses only one of the formatted input routines and does not also initialize a floating-point variable, the compiler does not load floating-point support.

Remove the comment indication from either or both of the two lines in the sample code below to eliminate the R6002 error.

Sample Code

   /*
    * Compile options needed: none
    */

   #include <stdio.h>
   float x ;

   main()
   {
   // Remove the comment from the next line to eliminate the error.
   // x = 2.3 ;

      scanf ("%f", &x) ;

   // Remove the comment from the next line to eliminate the error.
   // printf ("%f\n", x) ;
   }


Additional query words: floating point not loaded
Keywords : CRTIss kbfasttip
Version : 6.0 6.0a 6.0ax 7.0 1.0 1.5 2.0 4
Platform : MS-DOS NT OS/2 WINDOWS
Issue type : kbprb
Solution Type : kbcode


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.