这几天用VC2010编写了一个小程序,拷贝到另外一台计算机时候出现 float point support not loaded 的错误,搜索了下好像是float类型的数据未初始化,导致运行时未链接浮点库。float data[8];
sscanf(str,"%02X",data[i]); 将float data[8]; 改为float data[8] = {0};即可。或增加一个float参数函数,或为一个浮点数赋值,注意不要被优化掉。
Visual Studio 2010
floating-point support not loaded
The necessary floating-point library was not linked.
To fix by checking the following possible causes
1.
The program was compiled or linked with an option, such as /FPi87, that requires a coprocessor, but the program was run on a machine that did not have a coprocessor installed.
2.
A format string for a printf_s or scanf_s function contained a floating-point format specification and the program did not contain any floating-point values or variables.
3.
The compiler minimizes a program's size by loading floating-point support only when necessary.The compiler cannot detect floating-point format specifications in format strings, so it does not load the necessary floating-point routines.
4.
Use a floating-point argument to correspond to the floating-point format specification, or perform a floating-point assignment elsewhere in the program. This causes floating-point support to be loaded.
5.
In a mixed-language program, a C library was specified before a FORTRAN library when the program was linked. Relink and specify the C library last.
未链接必需的浮点库。
该程序通过选项(如 /FPi87,该选项要求有协处理器)被编译或链接,但该程序运行在一台未安装协处理器的计算机上。
printf_s 或 scanf_s 函数的格式字符串包含浮点格式规范,而该程序不包含任何浮点值或变量。
编译器仅当必要时才通过加载浮点支持以最小化程序大小。编译器无法检测到格式字符串中的浮点格式规范,因此编译器未加载必要的浮点例程。
使用浮点参数以符合浮点格式规范,或在程序的其他地方执行浮点赋值。该操作将导致加载浮点支持。
在由混合语言编写的程序中,当程序进行链接时在 FORTRAN 库之前指定了 C 库。重新链接并最后指定 C 库。