RAD Studio |  |

Printf/Scanf floating-point formats not linked (C++)

Floating-point formats contain formatting information that is used to manipulate floating-point numbers in certain runtime library functions, such as scanf() and atof(). Typically, you should avoid linking the floating-point formats (which take up about 1K) unless they are required by your application. However, you must explicitly link the floating-point formats for programs that manipulate fields in a limited and specific way.

Refer to the following list of potential causes (listed from most common to least common) to determine how to resolve this error:

- CAUSE: Floating point set to None. You set the floating-point option to None when it should be set to either Fast or Normal.
- FIX: Set Floating Point to Fast or Normal.
- CAUSE: Either the compiler is over-optimizing or the floating-point formats really do need to be linked. You need the floating-point formats if your program manipulates floats in a limited and specific way. Under certain conditions, the compiler will ignore floating-point usage in scanf(). For example, this may occur when trying to read data into a float variable that is part of an array contained in a structure.
- FIX: Add the following code to one source module:

Copy Code

    extern _floatconvert;
    #pragma extref _floatconvert

CAUSE: You forgot to put the address operator & on the scanf variable expression. For example:

Copy Code

    float foo;
    scanf("%f", foo);

FIX: Change the code so that the & operator is used where needed. For example, change the above code to the following:

Copy Code

    float foo;
    scanf("%f", &foo);

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!