我试图自己编译gts,它需要glib.
一个错误说找不到glib.h.我找到glib.h,并把它所在目录加入-I后,再编译又说找不到glib/galloca.h。
打开glib.h一看,有如下语句#include <glib/galloca.h>,可是没有glib目录了,galloca.h就在glib.h相同的目录。
它为什么这么写呢?
编译gts的问题
-
- 帖子: 40
- 注册时间: 2013-02-19 6:28
Re: 编译gts的问题
我把glib.h移到上一层目录。
再编译,可以了。
但新的问题又来了。编译predicates_init.c时说_PC_53没声明。
predicates_init.c中包含的rounding.h文件里代码如下:
这个 _controlfp()函数的用途是 - get and set floating point control word
_MCW_PC 0x00030000
_PC_53 0x00010000
和机器是直接相关的,是不是把这个把值直接带进去?
再编译,可以了。
但新的问题又来了。编译predicates_init.c时说_PC_53没声明。
predicates_init.c中包含的rounding.h文件里代码如下:
代码: 全选
# elif __MINGW32__
# include <float.h>
static unsigned int fpu_init;
# define FPU_ROUND_DOUBLE (fpu_init = _controlfp (0, 0),\
_controlfp (_PC_53, _MCW_PC))
# define FPU_RESTORE (_controlfp (fpu_init, 0xfffff))
_MCW_PC 0x00030000
_PC_53 0x00010000
和机器是直接相关的,是不是把这个把值直接带进去?
代码: 全选
The following program turns on floating-point exceptions:
http://www.suacommunity.com/man/3/_controlfp.3.html
#include
#include
main()
{
double x, y;
unsigned int mask;
x = 1.0;
y = 0.0;
mask = _controlfp(0,0);
printf("old floating-point control mask = %#x\n", mask);
printf("%g=\n", x / y);
/* turn on floating point exceptions */
mask = _controlfp(0, _MCW_EM);
printf("new floating-point control mask = %#x\n", mask);
printf("%g\n", x / y );
}