2013-03-14 85 views
0

我試圖在遠程超級計算機上運行一個程序,該程序在我的筆記本上運行良好。但該程序不在那裏編譯。試圖追蹤這個問題,我將程序降低到最低程度,但仍然給我一個編譯錯誤。任何人有任何想法可能在這裏出錯?Fortran:CHARACTER聲明中的語法錯誤

[[email protected] python_utilities]$cat test.f90 
program test 
character(:), allocatable :: out 
end program test 
[[email protected] python_utilities]$gfortran test.f90 
In file test.f90:3 

character(:), allocatable :: out 
     1 
Error: Syntax error in CHARACTER declaration at (1) 

我猜gfortran運行正常,當我這樣做時,它的工作原理:

[[email protected] python_utilities]$cat test.f90 
program test 
print *, "Hello World!" 
end program test 
[[email protected] python_utilities]$gfortran test.f90 
[[email protected] python_utilities]$./a.out 
Hello World! 

在超級計算機編譯器是:

[[email protected] 256]$gfortran --version 
GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51) 
Copyright (C) 2007 Free Software Foundation, Inc. 

回答

0

character(:), allocatable :: out正在申報的可分配定標器。這是Fortran 2003的一項新功能。超級計算機上的編譯器可能不支持此新功能。

你意味着你正在使用gfortran。 http://gcc.gnu.org/wiki/GFortran列出了在gfortran 4.5版中添加的可分配縮放器(參見4.5/Fortran 2003)。目前的發行版本是4.7。

+0

我看,超級計算機上的編譯器確實老了。它是:[k00603 @ fe01p08 256] $ gfortran --version GNU Fortran(GCC)4.1.2 20080704(Red Hat 4.1.2-51) 版權所有(C)2007自由軟件基金會,Inc. – jhaprade 2013-03-14 06:33:54

+0

您應該得到SysAdmin升級。 gfortran 4.1版已經過時並且有錯誤。 4.3之前我不會使用任何版本。原則上你可以在你的用戶區安裝編譯器,但這並不容易。 – 2013-03-14 07:16:47

1

CHARACTER(:)...是一個Fortran 2003功能,稱爲延遲長度字符。它最近才被添加到gfortran中,並且在某些區域的支持(延期長度字符組件)仍然不完整。

您的超級計算機可能運行的是舊版本的編譯器,它缺少對此功能的支持。

+0

是否可以在我的用戶帳戶中安裝gfortran的本地最新版本而不會破壞超級計算機的系統管理員? – jhaprade 2013-03-14 06:37:44

+0

也許。我在這裏有我的用戶帳戶從源代碼構建的gfortran的六個版本。 – IanH 2013-03-14 08:33:02