INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Problem compiling a .for file

Problem compiling a .for file

(OP)
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

RE: Problem compiling a .for file

The compiler says Missing ')'.
It sems to be missnig here:

CODE

DOUBLE PRECISION P(NSS,NSS),EXPV,DD(NSS,NSS),PL(NSS),SR(NSS),QB(NS) 

In the second case it's similar

RE: Problem compiling a .for file

(OP)
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

RE: Problem compiling a .for file

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


RE: Problem compiling a .for file

(OP)
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

RE: Problem compiling a .for file

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

C PROGRAM FOR SOLVING REVISED TOBINQ MODEL WITH COLLATERAL CONSTRAINT 
to

CODE

! 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

RE: Problem compiling a .for file

Quote:


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 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close