【Fortran】使用f77编译器编译.f文件,编译出的.c文件中出现函数名冲突
帮物理老师安装一个计算软件 【下载】
在make的时候出现这样的错误
make[1]: 正在进入目录 `/home/revol/下载/fac/coul'
cc -c -o coulcc.o coulcc.c
coulcc.c:2160:12: error: conflicting types for ‘cf1r_’
doublereal cf1r_(doublereal *x, doublereal *eta, doublereal *zl, doublereal *
^
coulcc.c:132:23: note: previous declaration of ‘cf1r_’ was here
extern doublereal cf1r_(doublecomplex *, doublecomplex *, doublecomplex *,
^
make[1]: *** [coulcc.o] 错误 1
在fortran源码中,cf1r函数只有一个定义
FUNCTION CF1R(X,ETA,ZL,EPS,FCL,TPK1,ETANE0,LIMIT,ERR,NFP,
X ACCH,FPMIN,FPMAX,PR,CALLER)
经过f2c转换为.c文件后出现了重复定义
f2c的错误信息如下:
revol@Revol:~/下载/fac/coul$ f2c coulcc.f
coulcc.f:
coulcc:
cf1c:
cf2:
cf1r:
Warning on line 964 of coulcc.f: inconsistent calling sequences for cf1r,
arg 1: here double precision variable, previously double complex variable.
arg 2: here double precision variable, previously double complex variable.
arg 3: here double precision variable, previously double complex variable.
f20:
cf1a:
Warning on line 1147 of coulcc.f: local variable ci never used
rcf:
tidy:
在.c文件中出现了两次定义:
doublereal cf1r_()
和
extern doublereal cf1r_()
求解!这个软件弄了很久了,本人因为不会fortran所以完全看不懂源码。
我的编译环境是ubuntu 14.04,f77什么的都是直接从源里装的
ChuFFy
10 years, 5 months ago