主题:CVF6.5支持F77吗
dingsheng1206
[专家分:0] 发布于 2010-06-23 14:59:00
我用CVF6.5调试f77程序时出错了,
报错如下,
--------------------Configuration: my practice - Win32 Debug--------------------
Compiling Fortran...
E:\Program Files\kernel.f
f90: Error: Illegal character in statement label field [s]
f90: Error: Illegal character in statement label field [u]
f90: Error: Illegal character in statement label field [b]
f90: Error: Illegal character in statement label field [r]
f90: Error: Illegal character in statement label field [o]
f90: Error: First statement in file must not be continued
E:\Program Files\kernel.f(1) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( % . = =>
subroutine kernel(r,dx,hsml,w,dwdx)
--------------------------------------^
Error executing df.exe.
kernel.obj - 7 error(s), 0 warning(s)
这是什么问题啊,
版本的问题吗?不是说CVF编译器向下兼容的吗??谢谢哦
回复列表 (共22个回复)
沙发
timwan [专家分:0] 发布于 2010-06-24 17:51:00
顶行加“!dec$ freeform”
板凳
cgl_lgs [专家分:21040] 发布于 2010-06-25 10:24:00
要不全改成自由格式吧,前面那个贴已说了,固定格式与自由格式是不通用的,不能相互包含:)
3 楼
dingsheng1206 [专家分:0] 发布于 2010-06-26 15:55:00
[quote]顶行加“!dec$ freeform”[/quote]
你好,我的全是固定格式的F77语言啊,只不过是用CVF6.5编译的,不是说它向下兼容吗,
另外如果按你的建议办法试,那是要加“!dec$ freeform”还是加!dec$ freeform啊,谢谢!!
4 楼
dingsheng1206 [专家分:0] 发布于 2010-06-26 15:57:00
[quote]要不全改成自由格式吧,前面那个贴已说了,固定格式与自由格式是不通用的,不能相互包含:)[/quote]
你好,我的全是F77固定写的啊,只不过用是编译器是CVF6.5。不是说它能向下兼容吗?谢谢哦
5 楼
yrliu [专家分:750] 发布于 2010-06-27 11:23:00
看你发这么多你的帖子,没看到代码,能贴出来吗?
6 楼
yrliu [专家分:750] 发布于 2010-06-27 11:25:00
[quote][quote]顶行加“!dec$ freeform”[/quote]
你好,我的全是固定格式的F77语言啊,只不过是用CVF6.5编译的,不是说它向下兼容吗,
另外如果按你的建议办法试,那是要加“!dec$ freeform”还是加!dec$ freeform啊,谢谢!![/quote]
这个问题不是fortran语言的问题,是汉语言双引号用法的问题。
7 楼
dingsheng1206 [专家分:0] 发布于 2010-06-27 14:19:00
[quote]看你发这么多你的帖子,没看到代码,能贴出来吗?[/quote]
先谢谢你哦,整个程序很长很大,有很多程序单元,我只给你帖出来出错的kernel子程序吧,
subroutine kernel(r,dx,hsml,w,dwdx)
c----------------------------------------------------------------------
c Subroutine to calculate the smoothing kernel wij and its
c derivatives dwdxij.
c if skf = 1, cubic spline kernel by W4 - Spline (Monaghan 1985)
c = 2, Gauss kernel (Gingold and Monaghan 1981)
c = 3, Quintic kernel (Morris 1997)
c r : Distance between particles i and j [in]
c dx : x-, y- and z-distance between i and j [in]
c hsml : Smoothing length [in]
c w : Kernel for all interaction pairs [out]
c dwdx : Derivative of kernel with respect to x, y and z [out]
implicit none
include 'param.inc'
double precision r, dx(dim), hsml, w, dwdx(dim)
integer i, j, d
double precision q, dw, factor
q = r/hsml
w = 0.e0
do d=1,dim
dwdx(d) = 0.e0
enddo
8 楼
dingsheng1206 [专家分:0] 发布于 2010-06-27 14:21:00
[quote]看你发这么多你的帖子,没看到代码,能贴出来吗?[/quote]
if (skf.eq.1) then
if (dim.eq.1) then
factor = 1.e0/hsml
elseif (dim.eq.2) then
factor = 15.e0/(7.e0*pi*hsml*hsml)
elseif (dim.eq.3) then
factor = 3.e0/(2.e0*pi*hsml*hsml*hsml)
else
print *,' >>> Error <<< : Wrong dimension: Dim =',dim
stop
endif
if (q.ge.0.and.q.le.1.e0) then
w = factor * (2./3. - q*q + q**3 / 2.)
do d = 1, dim
dwdx(d) = factor * (-2.+3./2.*q)/hsml**2 * dx(d)
enddo
else if (q.gt.1.e0.and.q.le.2) then
w = factor * 1.e0/6.e0 * (2.-q)**3
do d = 1, dim
dwdx(d) =-factor * 1.e0/6.e0 * 3.*(2.-q)**2/hsml * (dx(d)/r)
enddo
else
w=0.
do d= 1, dim
dwdx(d) = 0.
enddo
endif
else if (skf.eq.2) then
factor = 1.e0 / (hsml**dim * pi**(dim/2.))
if(q.ge.0.and.q.le.3) then
w = factor * exp(-q*q)
do d = 1, dim
dwdx(d) = w * ( -2.* dx(d)/hsml/hsml)
enddo
else
w = 0.
do d = 1, dim
dwdx(d) = 0.
enddo
endif
else if (skf.eq.3) then
if (dim.eq.1) then
factor = 1.e0 / (120.e0*hsml)
elseif (dim.eq.2) then
factor = 7.e0 / (478.e0*pi*hsml*hsml)
elseif (dim.eq.3) then
factor = 1.e0 / (120.e0*pi*hsml*hsml*hsml)
else
print *,' >>> Error <<< : Wrong dimension: Dim =',dim
stop
endif
if(q.ge.0.and.q.le.1) then
w = factor * ( (3-q)**5 - 6*(2-q)**5 + 15*(1-q)**5 )
do d= 1, dim
dwdx(d) = factor * ( (-120 + 120*q - 50*q**2)
& / hsml**2 * dx(d) )
enddo
else if(q.gt.1.and.q.le.2) then
w = factor * ( (3-q)**5 - 6*(2-q)**5 )
do d= 1, dim
dwdx(d) = factor * (-5*(3-q)**4 + 30*(2-q)**4)
& / hsml * (dx(d)/r)
enddo
else if(q.gt.2.and.q.le.3) then
w = factor * (3-q)**5
do d= 1, dim
dwdx(d) = factor * (-5*(3-q)**4) / hsml * (dx(d)/r)
enddo
else
w = 0.
do d = 1, dim
dwdx(d) = 0.
enddo
endif
endif
end
end
9 楼
yrliu [专家分:750] 发布于 2010-06-27 23:03:00
为啥最后用两个 end?
怎么觉得这几个错误不在这些代码里?
f90: Error: Illegal character in statement label field [s]
f90: Error: Illegal character in statement label field [u]
f90: Error: Illegal character in statement label field [b]
f90: Error: Illegal character in statement label field [r]
f90: Error: Illegal character in statement label field [o]
f90: Error: First statement in file must not be continued
10 楼
cgl_lgs [专家分:21040] 发布于 2010-06-28 06:56:00
你的KERNEL.F是固定格式的,但你INCLUDE的東西是自由格式的明白:)
我来回复