Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28701 Discussions

Anybody out there using VS Code + Modern Fortran extension + Ifort/Ifx on Windows?

Mark_Lewy
Valued Contributor I
1,033 Views

As the question suggests, I have been setting up Visual Studio Code with the Modern Fortran extension to use ifort on Windows and have had a few issues.  The repo I'm working with contains two major VS 2019 solutions, consisting of several Fortran, C/C++ and CUDA projects (some of which are in both solutions).  There are some other solutions present too: test harnesses and utilities, which I'm not worried about for the time being.   Our projects put output and intermediate files in $(ConfigurationName).$(PlatformName), hence the Debug.x64 below.  This is my current .vscode/settings.json for the repo:

 

{
    "cmake.configureOnOpen": false,
    "fortran.linter.compiler": "ifort",
    "fortran.linter.modOutput": "${fileDirname}/Debug.x64",
    "fortran.linter.extraArgs": [
        "/module:Debug.x64",
        "/I${env:IFORT_COMPILER21}compiler/include/intel64",
        "/I${workspaceFolder}/cs/iwpps/Debug.x64",
        "/I${workspaceFolder}/cs/simlib/Debug.x64",
        "/I${workspaceFolder}/ws/wneng_lib/Debug.x64",
        "/I${workspaceFolder}/ws/wspp_lib/Debug.x64",
        "/I${workspaceFolder}/infoworks_2d/iw_2d_sim/Lib1/Debug.x64",
        "/I${workspaceFolder}/infoworks_2d/iw_2d_sim/iw2d_simlib/Debug.x64",
        "/I${workspaceFolder}/infoworks_2d/iw_2d_sim/iw2d_siml1D/Debug.x64",
        "/I${workspaceFolder}/cs/iwsimstate/Debug.x64",
        "/I${workspaceFolder}/cs/tscal_lib/Debug.x64",
        "/I${workspaceFolder}/cs/swmm5_c_binding/Debug.x64",
        "/I${workspaceFolder}/cs/sim/Debug.x64"
    ],
    "fortran.linter.includePaths": [
        "${env:IFORT_COMPILER21}compiler/include/**",
        "${workspaceFolder}/cs/iwpps/**",
        "${workspaceFolder}/cs/simlib/**",
        "${workspaceFolder}/ws/wneng_lib/**",
        "${workspaceFolder}/ws/wspp_lib/**",
        "${workspaceFolder}/infoworks_2d/iw_2d_sim/Lib1/**",
        "${workspaceFolder}/infoworks_2d/iw_2d_sim/iw2d_simlib/**",
        "${workspaceFolder}/infoworks_2d/iw_2d_sim/iw2d_sim1D/**",
        "${workspaceFolder}/cs/iwsimstate/**",
        "${workspaceFolder}/cs/tscal_lib/**",
        "${workspaceFolder}/cs/swmm5_c_binding/**",
        "${workspaceFolder}/cs/sim/**"
],
"fortran.fortls.preprocessor.suffixes": [
    ".f90",
    ".F90"
],
"fortran.fortls.preprocessor.directories": [
    "${env:IFORT_COMPILER21}compiler/include",
    "${env:IFORT_COMPILER21}compiler/include/intel64"
],
"fortran.fortls.directories": [
    "${env:IFORT_COMPILER21}compiler/include",
    "${env:IFORT_COMPILER21}compiler/include/intel64",
    "${workspaceFolder}/cs/iwpps",
    "${workspaceFolder}/cs/simlib",
    "${workspaceFolder}/ws/wneng_lib",
    "${workspaceFolder}/ws/wspp_lib",
    "${workspaceFolder}/infoworks_2d/iw_2d_sim/Lib1",
    "${workspaceFolder}/infoworks_2d/iw_2d_sim/iw2d_simlib",
    "${workspaceFolder}/infoworks_2d/iw_2d_sim/iw2d_sim1D",
    "${workspaceFolder}/cs/iwsimstate",
    "${workspaceFolder}/cs/tscal_lib",
    "${workspaceFolder}/cs/swmm5_c_binding",
    "${workspaceFolder}/cs/sim"
],
"fortran.fortls.disableDiagnostics": false
}
 

 

  1.  I'm not convinced that adding the module directories to the linter extra arguments is the way to go, but the "standard" way seems to require me to open any dependencies before opening the file of interest to find objects in them.
  2. I'm not convinced all of these options support $(env:<value>), but then I'm not sure what escape characters, if any, I would need for an explicit path for the compiler (i.e "C:\Program Files (x86)\Intel\oneAPI\compiler\2022.0.0\windows\")
  3. As a consequence of 2 (?), compiler supplied modules like ifwin are showing up as not found: "Module "ifwin" not found in project", "#6580: Name in only-list does not exist or is not accessible. [BOOL]".
  4. Perhaps I should be using globs instead of long lists of paths?
0 Kudos
0 Replies
Reply