Seb
Seb

Reputation: 73

`Can't open module file, No such file or directory` when compiling Fortran with an external library

I am currently trying to compile a Fortran 90 code using a module that is supposed to be in a dynamic library libfckit.so. So far my code is:

program debug
use fckit_mpi_module
end program debug

And for the compilation step I use the following command:

mpifc -I/path/to/the/lib debug_fckit.f90 -o debug_fckit.exe

I get the following error:

use fckit_mpi_module
   1
Fatal Error: Can't open module file ‘fckit_mpi_module.mod’ for reading at (1): No such file or directory

I know that this is a common error in Fortran, I searched google but I did not find any satisfying solution for my case.

Upvotes: 2

Views: 3182

Answers (1)

Seb
Seb

Reputation: 73

Thank you Vladimir and Evets for your comments that helped me to fix the issue. I just added the paths to the directories where the module fckit_mpi_module.mod and the library libfckit.so are. So now my command for compiling the code reads:

mpifc -I/path/to/the/directory/where/the/module/fckit_mpi_module.mod/is -l/path/to/the/directory/where/the/library/lifckit.so/is debug.fckit.f90 -o debug_fckit

Hope this helps some other noobie like me.

Upvotes: 3

Related Questions