Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Huynh_T_
Beginner
578 Views

Fix "Error 5 error #6591: An automatic object is invalid in a main program" in Fortran

My code as below:

      include 'param.h'
      dimension alpha1(mx)
      open(99,file='checking.dat')

and there is an error: Error 5 error #6591: An automatic object is invalid in a main program.[alpha1]

I cannot understand what I can fix it. Can someone help me?

Thank you.

0 Kudos
1 Reply
Kevin_D_Intel
Employee
578 Views

I'd guess that MX has a defined value within param.h, however, the compiler did not find param.h to include it hence the error.

If param.h does not reside in the same directory as the source file from which the code snippet you show comes from then you need to assist the compiler in finding param.h with the appropriate compiler option. Refer to here for some guidance.

Reply