Page 1 of 1

Fortran 90 Compile Error

Posted: Fri Aug 12, 2016 8:30 am
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

Re: Fortran 90 Compile Error

Posted: Fri Aug 12, 2016 9:09 am
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

Re: Fortran 90 Compile Error

Posted: Fri Aug 12, 2016 10:29 am
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

Re: Fortran 90 Compile Error

Posted: Fri Aug 12, 2016 11:49 am
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

Re: Fortran 90 Compile Error

Posted: Sat Aug 13, 2016 1:21 am
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