Fortran 90 Compile Error

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
enricochinello
Posts: 3
Joined: Thu Aug 11, 2016 9:01 am

Fortran 90 Compile Error

Post by enricochinello »

Hello all,
I'm relatively new to Fortran 90 and I'm encountering several problems with
the following code.

Code: Select all

program hfss_main

!-------------------------------------------------------------------------------
! -- Use association --
use derived_data_types
use output
use ray_visual_module
use randdp
use interpol
use calc_functions, only: int_line_ellipsoid, int_line_plane,
int_line_sphere, normal_ellipsoid, tripod, unit_vector
use hfss_lamp
use hfss_geo
use hfss_init_termin
use hfss_results
use radiometer

! -- Null mapping --
implicit none
When I compile it, I have an error saying Fatal Error: Can't open module file 'derived_data_types.mod' for reading at (1): No such file or directory

The file derived_data_types.f90 exists and it's in the same folder. Could anyone please help me?

Thanks in advance!
Enrico
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Fortran 90 Compile Error

Post by jussij »

Hi Enrico,

I am no FORTRAN 90 expert but based on the error it looked to me like the compiler was not finding the file.

Guessed this might be due to some sort of include path setting (just like C and C++) a quick search on that topic came up with this hit:

https://gcc.gnu.org/onlinedocs/gfortran ... tions.html

-Idir
These affect interpretation of the INCLUDE directive (as well as of the #include directive of the cpp preprocessor).
Also note that the general behavior of -I and INCLUDE is pretty much the same as of -I with #include in the cpp preprocessor, with regard to looking for header.gcc files and other such things.


This path is also used to search for .mod files when previously compiled modules are required by a USE statement.

So that tells me I think you need to add something like this to the command line.

Code: Select all

-I.\

If that fails you could also try moving the mod files to SomeFolder and then changing that option to match:

Code: Select all

-I.\SomeFolder

Cheers Jussi
enricochinello
Posts: 3
Joined: Thu Aug 11, 2016 9:01 am

Re: Fortran 90 Compile Error

Post by enricochinello »

Hi Jussi,

Thanks for your reply.
I figured out the same but don't know how to solve it.
Could you please tell me how I should modify the code?

Thanks!
Enrico
enricochinello
Posts: 3
Joined: Thu Aug 11, 2016 9:01 am

Re: Fortran 90 Compile Error

Post by enricochinello »

jussij wrote:Hi Enrico,

I am no FORTRAN 90 expert but based on the error it looked to me like the compiler was not finding the file.

Guessed this might be due to some sort of include path setting (just like C and C++) a quick search on that topic came up with this hit:

https://gcc.gnu.org/onlinedocs/gfortran ... tions.html

-Idir
These affect interpretation of the INCLUDE directive (as well as of the #include directive of the cpp preprocessor).
Also note that the general behavior of -I and INCLUDE is pretty much the same as of -I with #include in the cpp preprocessor, with regard to looking for header.gcc files and other such things.


This path is also used to search for .mod files when previously compiled modules are required by a USE statement.

So that tells me I think you need to add something like this to the command line.

Code: Select all

-I.\

If that fails you could also try moving the mod files to SomeFolder and then changing that option to match:

Code: Select all

-I.\SomeFolder

Cheers Jussi
Hi Jussi,

Thanks for your reply.
I figured out the same but don't know how to solve it.
Could you please tell me how I should modify the code?

Thanks!
Enrico
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Fortran 90 Compile Error

Post by jussij »

Could you please tell me how I should modify the code?
I don't think you have to modify the code.

I think you have to modify the command line that is compiling the code.

I am also assuming you are using gfortran and Zeus and compiling the file using the Zeus Compiler, Compile menu.

That means you will have followed a setup something like this: viewtopic.php?f=5&t=6960

In that link it describes these two command lines:

Code: Select all

gfortran.exe "$fn" -o "$fdd$fb.exe"
gfortran.exe -c "$fn"
Depending on which of those command lines you have configured, you would need to change the command line to be something like this:

Code: Select all

gfortran.exe "$fn" -I.\ -o "$fdd$fb.exe"
gfortran.exe -c  -I.\ "$fn"
Cheers Jussi
Post Reply