Compile multiple files in FORTRAN (reproduced)

Source: Internet
Author: User

Recently, I need to compile multiple fortran programs in Linux and search for them online, but there is not much information. Maybe this problem is simple and not worth mentioning, but I still write what I know for your reference:

Method 1:
Assume there are two fortran programs, fun. f90 and Main. f90, where main. f90 is the main program, fun. f90 is a subroutine called in the main program. Put these two files in a directory and use the Fortran compiling command, such as Intel's ifort. The command is as follows:

Ifort-O exe_name fun. f90 main. f90

Or ifort-O exe_name main. f90 fun. f90

Method 2:
Add the include 'fun. f90' statement to the main program main. f90 and compile it with the Fortran command in Linux. The command is as follows:

Ifort-O exe_name main. f90

 

Method 3:
The command for step-by-step compilation is as follows:

Ifort-C main. f90 (after executing this command, a main. o file will be generated in the directory)

Ifort-C fun. f90 (after executing this command, a fun. o file will be generated in the directory)

Ifort-O exe_name fun. O main. O or ifort-O exe_name main. O fun. o

From: http://www.cnblogs.com/liyanwei/archive/2010/04/29/1723893.html

Compile multiple files in FORTRAN (reproduced)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.