【发布时间】:2011-05-03 16:37:31
【问题描述】:
我有一组构成 FORTRAN 代码的 .F 和 .H 文件。我在编译 .H 文件时遇到了麻烦。 .H 文件包含一堆公共块。 .H 文件之一的示例是:
*AC HEAD
c HEAD 1
common/blah/ x(25), y, z(25), p(25,mnv), HEAD 2
1 t(25,mx), d(25,mnv) HEAD 3
c HEAD 4
ETC...
当我在 google 上搜索答案时,据说 .h 文件是 c/c++ 文件,但它们看起来不像是用 c/c++ 编写的。 gfortran 似乎也认为它们是 C 文件。
当我尝试编译时:
gfortran-4.5 -fdefault-real-8 -fbacktrace -fno-align-commons HEAD.h
我得到错误:
cc1: warning: command line option "-fdefault-real-8" is valid for Fortran but not for C
cc1: warning: command line option "-fbacktrace" is valid for Fortran but not for C
cc1: warning: command line option "-fno-align-commons" is valid for Fortran but not for C
HEAD.h:1:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘HEAD’
我试图注释掉第一行 '*AC HEAD',但是错误是关于在 *.我是否需要在最后一列中添加一些带有 HEAD # 值的内容来将其注释掉,我是否需要使用 C++ 编译器构建 .H 文件或什么?
【问题讨论】:
-
那些是头文件,你不要编译它们
标签: fortran header-files fortran-common-block