客户在使用我们的应用程序时收到 R6002 运行时错误
我们有一个使用 Visual C++ 2005 构建的应用程序,一位客户报告说他遇到了以下运行时错误:
Microsoft Visual C++ 运行时库
运行时错误!
程序:[我们应用程序的路径]
R6002
- 未加载浮点支持
根据 Microsoft (在此页面),可能的原因是:
- 机器没有 FPU(本例中没有:客户有 Intel Core 2 Duo CPU,我还没有看到自 486SX 以来没有 FPU 的机器)
- printf 或 scanf 与浮点格式规范一起使用,但程序中没有 FP 变量(我们的应用程序包含 FP 变量,但我很确定我们从未将 printf 或 scanf 与 FP 格式一起使用)
- 与 FORTRAN 有关(我们的应用程序中没有 FORTRAN 代码)
此外,错误是在他们使用我们的应用程序时发生的(特别是在他们选择要处理的文件之后),而不是在应用程序启动时发生。
我意识到这是一个不太可能的事情,但是以前有人在任何地方见过这样的事情吗?谷歌并没有提供任何帮助(有很多未经证实的说法称这是某种病毒感染的症状,但除此之外几乎没有什么)。
如有任何建议,我们深表感谢:-)
We have an application built with Visual C++ 2005, and one customer has reported that he's getting this runtime error:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: [path to our application]
R6002
- floating point support not loaded
According to Microsoft (on this page), the possible reasons for this are:
- the machine does not have an FPU (not in this case: the customer has an Intel Core 2 Duo CPU and I haven't seen a machine without FPU since the 486SX)
- printf or scanf is used with a floating-point format specification but there are no FP variables in the program (our app contains FP variables but I'm pretty sure we never use printf or scanf with FP formats)
- Something to do with FORTRAN (no FORTRAN code in our app)
Also, the error is occurring while they're using our application (specifically, just after they select a file to be processed), not when the application starts up.
I realise this is a long shot, but has anyone seen anything like this anywhere before? Google was pretty unhelpful (there were lots of unsupported claims that it was a symptom of some kind of virus infection but very little apart from that).
Any suggestions gratefully received :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您正在链接 CRT 的静态版本吗?如果是这样,则需要在调用 printf() 的二进制文件中包含浮点变量。并且这些变量必须被真正使用(即没有被编译器优化掉)。
另一种可能性是 CRT 初始化和使用这些 FP 例程的代码之间的竞争,但这很难产生。
Are you linking a static version of the CRT? If so, you need to have floating point variables in the binary that calls printf(). And these variables have to be really used (i.e not optimized out by the comppiler).
Another possibility is a race between the CRT initialization and the code that uses these FP routines, but that would be hard to produce.
R6002 可能是由 printf 尝试打印包含百分号的字符串引起的。
此类 printf 失败的最可能根本原因是操纵任意文件并打印其名称的程序。让我惊讶的是,真的有人在文件名中添加百分号! (是的,我意识到这在技术上是合法的。)
R6002 can be caused by printf trying to print a string that contains a percent-sign.
Most likely root cause of such printf failure is a program that manipulates arbitrary files and prints their names. Amazing to me, there really ARE people who put percent-signs in file names! (Yes, I realize that is technically legal.)
printf("%f\n", (float)rand() / RAND_MAX);
我在使用 VS2010 命令行 cl 编译的程序中遇到了相同的运行时错误。
报告的错误在没有(浮动)转换的情况下发生,并在我添加它时消失。
printf("%f\n", (float)rand() / RAND_MAX);
I experienced the same runtime error in a program compiled with VS2010 command line cl.
The reported error occurred without the (float) cast and disappeared when I added it.