Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem compiling a .for file

Status
Not open for further replies.

DerrickKay87

Technical User
Nov 15, 2014
3
ES
Dear all,

I am new to fortran, I am just getting started. I installed the fortran compiler on my mac and I ran some first example .f95 codes. When I tried to run another code (I will attach it), I could not compile it. Does anyone know why this is? I am using a gfortran 4.9.2 compiler (it was difficult enough to get the whole thing working on my Mac after upgrading to Yosemite...)

The error message my terminal gives me is the following:
___

gfortran AERresub.for
AERresub.for:33.70:

DOUBLE PRECISION P(NSS,NSS),EXPV,DD(NSS,NSS),PL(NSS),SR(NSS),QB(NS
1
Error: Missing ')' in statement at or before (1)
AERresub.for:39.60:

DOUBLE PRECISION PLPRICE(NIPP),PLREAL(NIP*NIR),PIREAL(NIP*NIR,NIP*
1
Error: Missing ')' in statement at or before (1)

[...]
___

Any hint/suggestion is very much appreciated.
Best regards and thanks a lot
Cheers
Derrick
 
 http://files.engineering.com/getfile.aspx?folder=37457fc5-ff06-42f7-9a31-89ead8739944&file=AERresub.for
The compiler says [highlight]Missing ')'[/highlight].
It sems to be missnig here:
Code:
DOUBLE PRECISION P(NSS,NSS),EXPV,DD(NSS,NSS),PL(NSS),SR(NSS),[highlight]QB(NS[COLOR=red])[/color][/highlight]

In the second case it's similar
 
Thank you so much for the quick response!

I see what you mean and I thought of that... however, in the code AERresub.for the bracket ')' is actually there, so I am puzzled as to why I get this error... :/

thank you,
cheers,
Derrick
 
It seems that the ompiler tries to use fixed-form format which could be up to the 72 columns and it ignores everything from the 73-th column. To force the free-form format you can use the switch -ffree-form

But you say that you have Fortran 95 code. In this case change your file extension from *.for to the *.f95


 
Dear mikrom, thank you for your response.

I changed the ending to .f95, but when I try to compile that I get another error:

gfortran AERresub.f95
AERresub.f95:1:

C****************************************************************
1
Error: Unclassifiable statement at (1)
AERresub.f95:2:

C PROGRAM FOR SOLVING REVISED TOBINQ MODEL WITH COLLATERAL CONSTRAINT
1
Error: Unclassifiable statement at (1)
AERresub.f95:3:

C THAT SOLVES VIA ORDINARY VALUE FUNCTION ITERATION WITH
1
Error: Unclassifiable statement at (1)
AERresub.f95:4:
[...]

obviously, the 'C' seem to be a problem?

Could you explain a bit more how I can use the switch -ffree-form?

Best
Derrick

 
You said that you have f95 code, but in f95 these lines are syntactically incorrect.
Then you have to change all comments beginning with C to !, i.e. for example
Code:
[highlight]C [/highlight]PROGRAM FOR SOLVING REVISED TOBINQ MODEL WITH COLLATERAL CONSTRAINT
to
Code:
[highlight]! [/highlight]PROGRAM FOR SOLVING REVISED TOBINQ MODEL WITH COLLATERAL CONSTRAINT

If it should be a problem for you then try to complie the original *.for files witk the -ffree-form switch
 
Could you explain a bit more how I can use the switch -ffree-form?
for example so on the the command line:
Code:
gfortran AERresub.for -o AERresub -ffree-form
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top