Microsoft KB Archive/23873

{|
 * width="100%"|

PRB: R6002 From Floating-Point I/O without Floating-Point Math
'Article ID: Q23873

Creation Date: 23-NOV-1987

Revision Date: 05-AUG-1996' The information in this article applies to:

  The C Run-time (CRT) included with: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51, and 1.52 - Microsoft Visual C++ 32-bit Edition, versions 1.0, 2.0, 2.1 and 4.0 SYMPTOMS

In the MS-DOS, OS/2, and Windows NT operating systems, an attempt to run an application that does not perform any floating-point math fails and the run-time library generates the following message: R6002: floating point support not loaded In the Microsoft Windows operating system, the run-time library generates the following message: Floating point support not loaded CAUSE

Most often, this error occurs when a printf, scanf, or sscanf statement in the program contains a floating-point format specifier, such as %f, in the format string. RESOLUTION

To work around this problem, modify the source code to declare and initialize a local dummy variable of type "float" in the main function. Alternately, declare a dummy global variable of type "volatile float." Either of these steps should cause the linker to include floating-point support with the .EXE file. MORE INFORMATION

This error occurs because the linker includes floating-point modules in the linked code only when the code contains a float variable. Under most circumstances, this is desired behavior because the floating- point modules are quite large. However, if the code contains a floating-point format specifier and does not contain a float variable, the R6002 error occurs because the modules are required to perform the floating-point input and output conversions. In some cases, the technique outlined above does not work because the compiler detects (when it performs some optimizations) that the dummy variable is not used and removes the variable from the compiled code. Sample Code

/* Compiler options needed: none */ void main(void) { /* Uncomment this line to fix problem */ /* float x=1.0; */ printf("%f\n",1.0); } 
 * 1) include 
 * }

-

"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." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

Additional reference words: 6.00 6.00a 6.00ax 7.00 1.00 1.50 1.51 1.52 2.00

2.10 4.00

KBCategory: kbprg kbprb

KBSubcategory: CRTIss