Error: undefined reference to 'MAIN__'


Problem

When building an application, you get the error "undefined reference to 'MAIN__'"


Environment

Linux* and Mac OS* X


Root Cause :

You have attempted to link an application that does not contain a Fortran main program.


Resolution

If you are compiling sources separately to be linked later, add the -c option to the ifort command to tell the ifort driver not to invoke the linker.

If you are building a mixed-language application whose main program is not written in Fortran, use the

-nofor-main
option to specify this.

For more information, please refer to the Compiler Options section of the Intel Fortran Compiler User and Reference Guides.

 

如需更全面地了解编译器优化,请参阅优化注意事项