| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 649 人关注过本帖
标题:头文件问题
只看楼主 加入收藏
farmerbee
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2006-2-27
收藏
 问题点数:0 回复次数:4 
头文件问题

下面一个是 MATH.H头文件,小弟不明白,头文件中只是定义了一些函数头 并没有实现部分.说是对系统函数的引用又看不见引用的地址,情说说头文件原理好吗?




/*
* math.h
*
* Mathematical functions.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.3 $
* $Author: khan $
* $Date: 1998/09/03 16:31:17 $
*
*/

#ifndef _MATH_H_
#define _MATH_H_

/* All the headers include this file. */
#include <_mingw.h>

/*
* Types for the _exception structure.
*/

#define _DOMAIN 1 /* domain error in argument */
#define _SING 2 /* singularity */
#define _OVERFLOW 3 /* range overflow */
#define _UNDERFLOW 4 /* range underflow */
#define _TLOSS 5 /* total loss of precision */
#define _PLOSS 6 /* partial loss of precision */

/*
* Exception types with non-ANSI names for compatibility.
*/

#ifndef __STRICT_ANSI__
#ifndef _NO_OLDNAMES

#define DOMAIN _DOMAIN
#define SING _SING
#define OVERFLOW _OVERFLOW
#define UNDERFLOW _UNDERFLOW
#define TLOSS _TLOSS
#define PLOSS _PLOSS

#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */


#ifndef RC_INVOKED

#ifdef __cplusplus
extern "C" {
#endif

/*
* HUGE_VAL is returned by strtod when the value would overflow the
* representation of 'double'. There are other uses as well.
*
* __imp__HUGE is a pointer to the actual variable _HUGE in
* MSVCRT.DLL. If we used _HUGE directly we would get a pointer
* to a thunk function.
*
* NOTE: The CRTDLL version uses _HUGE_dll instead.
*/

#ifndef __DECLSPEC_SUPPORTED

#ifdef __MSVCRT__
extern double* __imp__HUGE;
#define HUGE_VAL (*__imp__HUGE)
#else
/* CRTDLL */
extern double* __imp__HUGE_dll;
#define HUGE_VAL (*__imp__HUGE_dll)
#endif

#else /* __DECLSPEC_SUPPORTED */

#ifdef __MSVCRT__
__MINGW_IMPORT double _HUGE;
#define HUGE_VAL _HUGE
#else
/* CRTDLL */
__MINGW_IMPORT double _HUGE_dll;
#define HUGE_VAL _HUGE_dll
#endif

#endif /* __DECLSPEC_SUPPORTED */

struct _exception
{
int type;
char *name;
double arg1;
double arg2;
double retval;
};


double sin (double x);
double cos (double x);
double tan (double x);
double sinh (double x);
double cosh (double x);
double tanh (double x);
double asin (double x);
double acos (double x);
double atan (double x);
double atan2 (double y, double x);
double exp (double x);
double log (double x);
double log10 (double x);
double pow (double x, double y);
double sqrt (double x);
double ceil (double x);
double floor (double x);
double fabs (double x);
double ldexp (double x, int n);
double frexp (double x, int* exp);
double modf (double x, double* ip);
double fmod (double x, double y);


#ifndef __STRICT_ANSI__

/* Complex number (for cabs) */
struct _complex
{
double x; /* Real part */
double y; /* Imaginary part */
};

double _cabs (struct _complex x);
double _hypot (double x, double y);
double _j0 (double x);
double _j1 (double x);
double _jn (int n, double x);
double _y0 (double x);
double _y1 (double x);
double _yn (int n, double x);
int _matherr (struct _exception *);

#ifndef _NO_OLDNAMES

/*
* Non-underscored versions of non-ANSI functions. These reside in
* liboldnames.a. Provided for extra portability.
*/
double cabs (struct _complex x);
double hypot (double x, double y);
double j0 (double x);
double j1 (double x);
double jn (int n, double x);
double y0 (double x);
double y1 (double x);
double yn (int n, double x);

#endif /* Not _NO_OLDNAMES */

#endif /* Not __STRICT_ANSI__ */

#ifdef __cplusplus
}
#endif

#endif /* Not RC_INVOKED */

#endif /* Not _MATH_H_ */

搜索更多相关主题的帖子: 文件 
2006-03-27 13:28
金为床兮银为椅
Rank: 1
等 级:新手上路
帖 子:183
专家分:0
注 册:2006-3-20
收藏
得分:0 

努力学习C、C++、LINUX、ORACLE、ENGLISH,累死为止。
2006-03-27 13:43
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
实现部分在Math?.lib

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2006-03-27 14:03
jiangzw625
Rank: 1
等 级:新手上路
帖 子:119
专家分:0
注 册:2006-3-27
收藏
得分:0 
头文件里并没有函数原形它只是声明,函数原形都在库函数里定义的

其实头文件和声明自己定义的函数的原理是一样的。只不过为了方便程序员不用一个

一个的把库函数里的函数声明一个一个的写出来。

用预处理include包含头文件是为了让编译器最后链接的时候可以按符号(就是函数名)

去库函数那里调用函数。

马马乎乎
2006-03-31 19:42
farmerbee
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2006-2-27
收藏
得分:0 
楼上大哥,明白了 ..谢谢!~~~
2006-04-05 09:27
快速回复:头文件问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022514 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved