PRB: R6002 May Result from printf() Use

ID Number: Q23873

4.00 5.00 5.10 6.00 6.00a 6.00ax | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

SYMPTOMS

In some situations, attempting to run a program that does not use

floating-point variables may result in the error message:

R6002: Floating point support not loaded

CAUSE

This error is most likely the result of a printf() or scanf()

statement in the program that contains a floating-point format

specifier, such as %f in the format string.

At link time, the floating-point library modules will not be loaded

unless floats are declared. This saves space by making the

executable file smaller. However, if floating-point support has not

been loaded and the program encounters a printf() floating-point

format specifier at run time, the R6002 error will be generated

because printf() needs the floating-point handling routines.

RESOLUTION

To work around this problem, you need to declare and initialize a

dummy variable of type float local to the main() function (or you

can declare it globally, if you specify the variable as volatile).

This should force the floating-point support to be linked into the

.EXE file.

Note: In some cases, this method may not work because the compiler

may detect (during some optimizations) that the float is never

used, and thus, remove it from the program.

Additional reference words: C 4.0 4.00 5.0 5.00 5.1 5.10 6.0 6.00 6.0a

6.00a 6.0ax 6.00ax Quickc 2.0 2.00 2.01 2.5 2.50 2.51