#7002: Error in opening the compiled module file

Hey,

I installed:
VsCode
Modern Fortran Version: 3.4.0
fortls 3.1.2

While editing the .f90 file, an error 7002 is displayed; however, I am able to right-click to locate the definition,which is suggesting that the module definition is indeed accessible?

[INFO - 12:13:56 AM] Extension Name: Modern Fortran

[INFO - 12:13:56 AM] Extension Version: 3.4.0

[INFO - 12:13:56 AM] Linter set to: "ifort"

[INFO - 12:13:56 AM] Formatter set to: "findent"

[INFO - 12:13:56 AM] Autocomplete set to: "fortls"

[INFO - 12:13:56 AM] Hover set to: "fortls"

[INFO - 12:13:56 AM] Symbols set to: "fortls"

[WARN - 12:13:57 AM] [lint] fypp currently only supports gfortran.

[INFO - 12:13:57 AM] [build.single] Compiler query command line: E:\intelOneAPI\compiler\2022.1.0\windows\bin\intel64\ifort.EXE -syntax-only -fpp -warn all -module c:\Users\xima\AppData\Roaming\Code\User\workspaceStorage\8cadb8e8b3f7a33dde6764f46a3b0ce1\fortran-lang.linter-gfortran\include -IC:\Users\xima\Desktop\aerodynDriver\modules -free -o c:\Users\xima\Desktop\aerodynDriver\modules\AeroDyn\src\AeroDyn_Driver_Subs.f90.o c:\Users\xima\Desktop\aerodynDriver\modules\AeroDyn\src\AeroDyn_Driver_Subs.f90

[WARN - 12:13:57 AM] [lint] fypp currently only supports gfortran.

[INFO - 12:13:57 AM] [lsp.client] Initialising Language Server for workspace: file:///c%3A/Users/xima/Desktop/aerodynDriver/modules

[INFO - 12:13:57 AM] [lsp.client] Language Server arguments: --enable_code_actions --hover_signature --use_signature_help --lowercase_intrinsics --nthreads=4 --notify_init --incremental_sync --source_dirs C:\Users\xima\Desktop\aerodynDriver\modules\ --include_dirs C:\Users\xima\Desktop\aerodynDriver\modules\

[INFO - 00:14:28] fortls - Fortran Language Server 3.1.2 Initialized

[INFO - 00:14:28] fortls initialization complete

Do you know why this occur?
Thanks

Welcome to the forum!

Such a message is usually the result of the compiler not being able to find the .mod file - the source file containing the module must first be compiled, which results in an object file (.o or .obj by extension) and a .mod file. This file must be found by the compiler for any source file that uses the module. Two reasons why it cannot be found:

  • The source file which defines this module has not been compiled yet
  • The .mod file is not in one of the directories where the compiler looks for such files.

You will need to check the compile options and the directory tree containing the sources etc. to determine which is the cause.

Thanks you. But if I am able to find the module definition by clicking the F12, does this indicate that the file path of module source file is correct?

No, the compiler needs to get the right directories and I am not sure that F12 is equivalent to the options that the compiler gets. You will need to check the full commands and the build logs. As I am not overly familiar with VSCode I can only make very wild guesses.