My code as below:
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?
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.