- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wrote the following piece of code.
I can't get the code to compile (Intel Visual Fortran Compiler XE 12.0.5.221). Any helpful comments would be appreciated.
[bash]module module_1
implicit none
type :: mod_1_type
integer(4) :: a = 10
end type mod_1_type
contains
subroutine sub_mod1 (t1, t2)
use module_2
type (mod_1_type), intent(inout) :: t1
type (mod_2_type), intent(inout) :: t2
call sub_mod2 (t1, t2)
end subroutine sub_mod1
end module module_1
module module_2
implicit none
type :: mod_2_type
integer(4) :: a = 20
end type mod_2_type
contains
subroutine sub_mod2 (t1, t2)
use module_1
type (mod_1_type), intent(inout) :: t1
type (mod_2_type), intent(inout) :: t2
end subroutine sub_mod2
end module module_2
program prog
use module_1
use module_2
type (mod_1_type) :: t1
type (mod_2_type) :: t2
call sub_mod1 (t1, t2)
end program prog
[/bash] I can't get the code to compile (Intel Visual Fortran Compiler XE 12.0.5.221). Any helpful comments would be appreciated.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello
Your modules are nested. Module_1 refers to Module_2 and needs it to be compiled and Module_2 refers to Module_1 and also needs it to be compiled. So it cannot be compiled.
You can define your 2 types mod_1_type and mod_2_type in a new "module_type" for example and refer to it in module1 and module_2.
Your modules are nested. Module_1 refers to Module_2 and needs it to be compiled and Module_2 refers to Module_1 and also needs it to be compiled. So it cannot be compiled.
You can define your 2 types mod_1_type and mod_2_type in a new "module_type" for example and refer to it in module1 and module_2.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page