2014-12-02 27 views
0

我遇到了這個簡單代碼的問題,給我下面的錯誤。 不知何故,它說與Intent (in)屬性有衝突。Fortran意圖(中)

gfortran -o build/lib/larsa.o -c -ffree-form -g -J./build/lib lib/larsa.f 
lib/larsa.f:2701.8: 

sep, sty, shr    & 
    1 
Error: PROCEDURE attribute conflicts with INTENT attribute in 'sep' at (1) 
lib/larsa.f:2710.17: 

If (Len_trim (sep) > 0) Then 
      1 
Error: 'string' argument of 'len_trim' intrinsic at (1) must be CHARACTER 

這是子程序

Subroutine write_separator_new & 
    (       & 
    sep, sty, shr    & 
) 

Character (len=*), Intent(in) :: sep, sty 
Integer, Intent(in), Optional :: shr 

Character (len=65) :: a, fmt 

If (Len_trim (sep) > 0) Then 
    a = Repeat (sep(1), 60) 
Else 
    Write (*,*) "" 
End If 

End Subroutine write_separator_new 

回答

4

字符串的索引需要:

a = Repeat (sep(1:1), 60) 

編譯器假定sep是AA功能,因爲你用它本身,而不是作爲一個字符串。