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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compiler won't take a function in one program but will in another. 1

Status
Not open for further replies.

paul79

Technical User
Jul 31, 2009
12
CA
Hi, I am having trouble compiling a program, it is telling me that it expects another right bracket but there are the correct number of brackets. The program is nm.f, it calls a function f.f and that is where the trouble is.

Here is the error

In file f.f:29

pred1= ((1+exp(-(x-q(j,0))/((q(j,0)**0.5)*w**0.5)))**-1.0)
1
Error: Expected a right parenthesis in expression at (1)
 
Is q a function or an array? Either way it has to be declared.

Minor note: xx ** -1.0 is the same as 1.0 / xx. The latter is a lot faster.
 
hi there, q is an array that is common and declared.
 
In the non working one, check whether you have common blocks, or functions called x, q, w, exp.

How is q declared? Is it something like q(0:10,0:20)

Also, if you're using F77, check that the last bracket hasn't gone over colum 72. My second program in Fortran had that problem and it took a very long time to work it out.
 
Thanks xwb, I didn't declare the array q in the original program that will use the function as a subroutine, therefore it was not recognizing q. Thank you so much! Oh, also before I have run into problems with running over column 72 before. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top