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

查看:109
本文介绍了如何启用连接浮点库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 ++)。 Borland的
  编译器自作聪明,而不是链接
  在浮点(F-P)库
  除非你需要它。唉,他们都得到
  该决定是错误的。一个常见的​​情况是
  在那里你不叫任何法布里 - 珀罗
  功能,但你必须%F 或其他
  法布里 - 珀罗格式 scanf()的的printf()
  呼叫。治愈是调用一架F-P
  功能,或至少力之一是
  present中的链接。

"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天全站免登陆