问题
Sublime Text 3 has a package that links the text editor to Gfortran and it runs without any problems. I would like to know how can I add Intel Fortran as a custom build to Sublime Text 3? From what I understand I need to go on build systems and create a new file with code similar to the one below (this is an example for gfortran).
{
"cmd": "gfortran ${file} -o ${file_base_name}",
"selector": "source.modern-fortran, source.fixedform-fortran",
}
How could I do this for Intel Fortran?
Extra:
This was asked before for Linux (I use Windows) here: Sublime Text 2 Build (Ctrl +B) Intel Fortran Compiler . The fix is supposed to be:
"cmd": ["ifort","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.fortran90"
But it doesn't work on my PC. I get the following message:
[WinError 2] The system cannot find the file specified
[cmd: ['ifort', 'C:\\Users\\username\\Desktop\\fortranfile.f90']]
[dir: C:\Users\username\Desktop]
[path: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.4.210\windows\mpi\intel64\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\compiler;C:\MinGW\bin;C:\cygwin64\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\windows\system32;C:\MinGW\bin]
[Finished]
回答1:
I managed to run Intel Fortran on Sublime Text 3 by creating a new file in New Build System as follows (I am using Intel 64 Visual Studio 2013 environment):
{
"cmd": ["cmd", "/e:on", "/v:on", "/k", "ipsxe-comp-vars intel64 vs2013 && ifort ${file}"],
"file_regex": "^.*\\\\([0-9A-Za-z_]+\\.[A-Za-z0-9]+)\\(([0-9]+)\\):[ ]+error[ ]+#([0-9]+):[ ]+(.*)$",
"working_dir":"${file_path}",
"selector":"source.f ,source.for ,source.ftn ,source.f90 ,source.fpp ,source.i ,source.i90",
"encoding":"cp936",
"path":"C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.4.210\\windows\\bin;${path}",
"variants":
[
{
"name": "Run",
"cmd": ["cmd", "/e:on", "/v:on", "/c", "ipsxe-comp-vars intel64 vs2013 && ifort ${file} && ${file_base_name}"]
}
]
}
来源:https://stackoverflow.com/questions/45887692/running-intel-fortran-on-sublime-text-3