- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a compilation issue occured when circular reference is employed. See the codes:
module test1
implicit none
integer, parameter :: a = 5
interface
module subroutine sub1()
end subroutine sub1
end interface
end module test1
submodule(test1) submodule1
use test2
implicit none
contains
module procedure sub1
implicit none
print*, b
end procedure sub1
end submodule submodule1
module test2
implicit none
integer, parameter :: b = 4
interface
module subroutine sub2()
end subroutine sub2
end interface
end module test2
submodule(test2) submodule2
use test1
implicit none
contains
module procedure sub2
implicit none
print*, a
end procedure sub2
end submodule submodule2
program main
use test1
use test2
!TO DO.
end program main
The use association in submodules are permitted by the standard. An error shows up when compile for the first time:
error #7002: Error in opening the compiled module file. Check INCLUDE paths. [TEST2]
If then we compile it again without cleanning-up, the target assembly will be created successfully. So is it a compiler mistake ? Or how should I do to solve it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Blane J. wrote:
Yes Andrew, they are all in the same file, separate case gives the same result.
In the same file is a certain fail, and would be a bit daft as the whole point of submodules is to separate the interface from the implimentation to avoid build cascades. You are forcing things to be all recompiled.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes Andrew, they are all in the same file, separate case gives the same result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1>------ Build started: Project: blane_test, Configuration: Debug Win32 ------ 1>Compiling with Intel(R) Visual Fortran Compiler 18.0.0.124 [IA-32]... 1>Source2.f90 1>Source4.f90 1>Source3.f90 1>Source5.f90 1>Source1.f90 1>Linking... 1>Embedding manifest... 1> 1>Build log written to "file://C:\Users\....\blane_test\Debug\BuildLog.htm" 1>blane_test - 0 error(s), 0 warning(s) ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
It works OK for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Blane J. wrote:
Yes Andrew, they are all in the same file, separate case gives the same result.
In the same file is a certain fail, and would be a bit daft as the whole point of submodules is to separate the interface from the implimentation to avoid build cascades. You are forcing things to be all recompiled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I then splited those entities each into different files and had the same result as you did, previously I only isolate the main program from the modules and submodules. Thanks Andrew.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page