PRB: "Floating-point Support Not Loaded" Error with scanf()
View products that this article applies to.
Article ID : 37507
Last Review : September 17, 2003
Revision : 1.0
This article was previously published under Q37507
On This Page
SYMPTOMS
CAUSE
RESOLUTION
STATUS
MORE INFORMATION
Sample Code
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.
Back to the top
CAUSE
The compiler does not generate a reference to the __fltused variable that instructs the linker to load the floating-point support module.
Back to the top
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.
Back to the top
STATUS
This behavior is expected. To minimize the size of the executable file, the compiler loads floating-point support only when it is required.
Back to the top
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.
Back to the top
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) ;
}
To copy a dialog resource from a resource file of a Visual C++ .NET or Visual C++ 2005 project to a resource file of another Visual C++ .NET or Visual C++ 2005 project, follow these steps.
Note A resource file has an .rc extension.
1.
Start Visual Studio .NET or Visual Studio 2005.
2.
On the File menu, point to Open, and then click File.
3.
Locate the source resource file.
4.
Click the resource file, and then click Open to open the file.
5.
Perform steps 2 through 4 for the destination resource file.
6.
To switch to the source resource file, click the tab that contains the file name of this file.
7.
Expand the folder that has the same name as the file name of the source resource file.
8.
Expand the Dialog folder.
9.
Right-click the dialog resource that you want to copy, and then click Copy.
10.
To switch to the destination resource file, click the tab that contains the file name of this file.
11.
Right-click the folder that has the same name as the file name of the destination resource file, and then click Paste. The dialog resource appears in the Dialog folder of the target resource file.
12.
Press the CTRL+SHIFT+S key combination to save all files.
13.
On the File menu, click Close Solution to close the solution.
여기서 중요한 부분은 1번.. 6.0처럼 프로젝트를 열고 source rc를 열면 안된다는거.
댓글을 달아 주세요