2017-10-19 79 views
1

我试图使用dieharder来测试随机序列的质量。为了在Windows上编译它,我安装了msys和gsl开发。 GSL编译时没有任何问题。要编译Dieharder,我第一次运行./configure ,然后当我在MSYS进入make,它返回如下错误信息:Dieharder随机测试套件不编译

(cd libdieharder; \make) 
make[1]: Entering directory `/f/dieharder-3.31.1/libdieharder' 
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DVERSION=3.31.1 -DLITTLE_ENDIAN=1 -I ../include -I /usr/local/include -std=c99 -Wall -pedantic -g -O2 -MT libdieharder_la-dab_dct.lo -MD -MP -MF .deps/libdieharder_la-dab_dct.Tpo -c -o libdieharder_la-dab_dct.lo `test -f 'dab_dct.c' || echo './'`dab_dct.c 
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DVERSION=3.31.1 -DLITTLE_ENDIAN=1 -I ../include -I /usr/local/include -std=c99 -Wall -pedantic -g -O2 -MT libdieharder_la-dab_dct.lo -MD -MP -MF .deps/libdieharder_la-dab_dct.Tpo -c dab_dct.c -DDLL_EXPORT -DPIC -o .libs/libdieharder_la-dab_dct.o 
make[1]: Leaving directory `/f/dieharder-3.31.1/libdieharder' 

错误消息是:

dab_dct.c: In function 'fDCT2': 
dab_dct.c:251:44: error: 'M_PI' undeclared (first use in this function) 
     output[i] += (double) input[j] * cos((M_PI/len) * (0.5 + j) * i); 
              ^~~~ 
dab_dct.c:251:44: note: each undeclared identifier is reported only once for each function it appears in 
dab_dct.c: In function 'iDCT2': 
dab_dct.c:274:30: error: 'M_PI' undeclared (first use in this function) 
     sum += input[j] * cos(((M_PI * j)/len) * (0.5 + i)); 
           ^~~~ 
dab_dct.c: In function 'evalMostExtreme': 
dab_dct.c:289:15: warning: variable 'pos' set but not used [-Wunused-but-set-variable] 
    unsigned int pos = 0; 
       ^~~ 
make[1]: *** [libdieharder_la-dab_dct.lo] Error 1 
make[1]: Leaving directory `/f/dieharder-3.31.1/libdieharder' 
make: *** [libwulf.time] Error 2 

我的问题是我是否应该申报文件开头的M_PI或我在安装过程中出错?

+0

@KenWhite,对不起,你是对的。我已经添加了错误消息。 – David

回答

0

常量在math.h中,您可以在其中找到M_PI。