Expected a right parenthesis in expression
12,217
Solution 1
You are missing line continuation characters. They differ slightly for free and fixed form Fortran. For free form, you need to use &
at the end of the line:
xic = ac * x**2.D0 * ( (1.D0 / 3.D0) * (1.D0 - x) * &
(1.D0 + 10.D0 * x + x** 2.D0) &
+ 2.D0 * x * (1.D0 - x) * Log(x) )
For fixed-format this can be done by e.g. &
at the sixth column of the following line:
xic = ac * x**2.D0 * ( (1.D0 / 3.D0) * (1.D0 - x) *
& (1.D0 + 10.D0 * x + x** 2.D0)
& + 2.D0 * x * (1.D0 - x) * Log(x) )
Alternatively, you can extend the maximum allowed characters by using (gfortran
) -ffree-line-length-0
or -ffixed-line-length-0
.
Solution 2
Check the following methods to cut a long line in Fortran : http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap01/continue.html
Author by
Admin
Updated on June 28, 2022Comments
-
Admin almost 2 years
xic = ac * x**2.D0 * ( (1.D0 / 3.D0) * (1.D0 - x) * (1.D0 + 10.D0 * x + x** 2.D0) + 2.D0 * x * (1.D0 - x) * Log(x) )
I was compiling the above code with fortran and got one error
Expected a right parenthesis in expression at (1)
what should i do?