Fortran Syntax Error In Call Statement
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers
Syntax Error In Write Statement At (1)
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x fortran line length Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it error: unclassifiable statement at (1) only takes a minute: Sign up Syntax error in call statement in Fortran up vote 0 down vote favorite I have written a simple test program to try subroutines and the call statement in Fortran. I am using gfortran compiler
Fortran Unclassifiable Statement
in GNU/Linux. I have declared 14 parameters which are numbered accordingly in my code. While my code works PERFECTLY WELL when I try to pass 11 of those arguments through the call statement, I encounter a rather strange 'SYNTAX ERROR' when I try to include a 12th argument and I try to pass 12 arguments through the call statement. What might the problem be and how might I fix it? Here is the program I am talking about ` program
Fortran Line Continuation
test IMPLICIT REAL*4(A-B,D-H,O-Z) IMPLICIT COMPLEX(C) COMPLEX*16 CQC,CQV parameter k1=2 parameter k2=2 parameter k3=2 parameter k4=2 parameter k5=2 parameter k6=2 parameter k7=2 parameter k8=2 parameter k9=2 parameter k10=2 parameter k11=2 parameter k12=2 parameter k13=2 parameter k14=2 call bins(k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12) end program subroutine bins(k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12) integer k1, k2, k3, k4, k5 end subroutine ` Following is the error that I get when I include k12 in the 'call' statement and then compile it: ` siddharth@siddharth-VBox:~/Desktop/Codes$ gfortran test6.for -o test6.out test6.for:23.72: call bins(k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12 1 Error: Syntax error in argument list at (1) test6.for:29.72: subroutine bins(k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k1 1 Error: Unexpected junk in formal argument list at (1) test6.for:2.72: program test 1 test6.for:31.72: integer k1, k2, k3, k4, k5 2 Error: Two main PROGRAMs at (1) and (2) ` I reiterate that I don't encounter any problems in compiling when I include the arguments k1 to k11 in the call statement, its just the introduction of a 12th argument that introduces the problem. Any help will be appreciated. fortran share|improve this question edited Jun 20 '14 at 21:10 asked Jun 20 '14 at 20:51 SiddTheKid 313 5 assume you are using fixed form fortran you cant go past column 72. &nda
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Fortran 'call' statement: what can it http://stackoverflow.com/questions/24335487/syntax-error-in-call-statement-in-fortran actually call? up vote 1 down vote favorite I've inherited about 400 lines of very weirdly written Fortran 77 code, and I'm trying to analyze it step by step to make it clear in my mind. Anyway, I have an header-like file (actually a .h, but the code in it is in fortran not C/C++) with JUST two statements in it, called getarg.h: character*80 serie integer http://stackoverflow.com/questions/13179137/fortran-call-statement-what-can-it-actually-call ln Then I have another fortran file (.f) called getserie.h which has this code inside it: subroutine getserie(serie, ln) include 'getarg.h' call getarg(1, serie) ln = index(serie, ' ') - 1 return end My question being: can I call an external file with just variables declarations in it? What's the effect of doing this? fortran fortran90 subroutine fortran77 share|improve this question asked Nov 1 '12 at 14:25 whatyouhide 5,28232551 add a comment| 3 Answers 3 active oldest votes up vote 6 down vote accepted No, you can call only subroutines. This means subprograms designated as subroutine. However the definition of the subroutine does not have to be in your source file. It just have to be supplied at link time. The getarg subroutine is probably an intrinsic subroutine of your compiler which gets the command line arguments. This means that the compiler provides the code of the subroutine to the linker automatically. The file getarg.h is not called in any way. Its content is just copied directly to the place of the include statement. There are situations where you need to have an (explicit) interface of the called subroutine available, but in later Fortran versions, 90 and
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta http://stackoverflow.com/questions/13354510/fortran-error-meanings Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, syntax error helping each other. Join them; it only takes a minute: Sign up Fortran Error Meanings up vote 2 down vote favorite I have been following books and PDFs on writing in FORTRAN to write an integration program. I compile the code with gfortran and get several copies of the following errors. 1)Unexpected data declaration statement at (1) 2)Unterminated syntax error in character constant beginning at (1) 3)Unclassifiable statement at (1) 4)Unexpected STATEMENT FUNCTION statement at (1) 5)Expecting END PROGRAM statement at (1) 6)Syntax error in data declaration at (1) 7)Statement function at (1) is recursive 8)Unexpected IMPLICIT NONE statement at (1) I do not know hat they truly mean or how to fix them, google search has proven null and the other topics on this site we about other errors. for Error 5) i put in Program main and end program main like i might in C++ but still got the same result. Error 7) makes no sense, i am trying for recursion in the program. Error 8) i read implicit none was to prevent unnecessary decelerations. Ill post the code itself but i am more interested in the compiling errors because i still need to fine tune the array data handling, but i cant do that until i get it working. Program main implicit none real, dimension(:,:), allocatable :: m, oldm real a integer io, nn character(30) :: filename rea