user2898446
user2898446

Reputation: 1

compile fortran code from sublime Text

In order to produce the .o file for a fortran program I write the following command in my command prompt in windows.

gfortran -c test.for

What I would like to do is either to access cmd from Sublime Text 2 directly or to link the previous command to a shortcut in sublime and get the output in the sublime command line.

In other discussions it is stated that you can do that for the Intel Fortran Compiler.

Upvotes: 0

Views: 2619

Answers (1)

Derek Redfern
Derek Redfern

Reputation: 1009

See this article about build systems in Sublime Text: https://docs.sublimetext.io/guide/usage/build-systems.html

Basically, you can configure Sublime so that it runs a specified command when you select the build type and press F7. The simplest type of build configuration would be a file called fortran.sublime-build with the following contents:

{
    "cmd": ["gfortran", "-c", "$file"]
}

The output of the program will appear in the Sublime Console (View -> Show Console).

Upvotes: 1

Related Questions