如何在 TurboC 中启用链接浮点库? [英] How to enable linking floating point library in TurboC?

查看:11
本文介绍了如何在 TurboC 中启用链接浮点库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C语言的新手...只是想问一下如何在TurboC中启用链接浮点库?

I'm newbie in C language... Just want to ask how to enable linking floating point library in TurboC?

推荐答案

来自comp.os.msdos.programmer 常见问题解答:

浮点格式未链接"是Borland 运行时错误(Borland C 或C++、Turbo C 或 C++).博兰德的编译器试图变得聪明而不是链接在浮点 (f-p) 库中除非你需要它.唉,他们都得到决定错误.一种常见的情况是你不打电话给任何 f-p功能,但你有 %f 或其他scanf()printf() 中的 f-p 格式来电.解决方法是调用 f-p功能,或至少强制一个出现在链接中.

"Floating point formats not linked" is a Borland run-time error (Borland C or C++, Turbo C or C++). Borland's compilers try to be smart and not link in the floating- point (f-p) library unless you need it. Alas, they all get the decision wrong. One common case is where you don't call any f-p functions, but you have %f or other f-p formats in scanf() or printf() calls. The cure is to call an f-p function, or at least force one to be present in the link.

为此,定义这个函数源文件中的某处,但不要叫它:

To do that, define this function somewhere in a source file but don't call it:

static void forcefloat(float *p)   
{
     float f = *p;
     forcefloat(&f);    
}

它不必在模块中与主程序,只要它是在将包含在的模块中链接.

It doesn't have to be in the module with the main program, as long as it's in a module that will be included in the link.

这篇关于如何在 TurboC 中启用链接浮点库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆