<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Submodule Linking error LNK2005 in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213810#M152066</link>
    <description>&lt;P&gt;Thanks for all of the replies.&amp;nbsp; The actual source code in these subroutines is thousands of lines long (contained in single files), which is why I am trying to split them up.&amp;nbsp; I copied and pasted the interfaces and module subroutine calls into the sample code but this modified code unfortunately does not produce the linker error.&amp;nbsp; I left the alternate return in for now as it does not seem to be the cause of the problem, although I realize it is obsolete.&amp;nbsp; I have struggled for hours trying to figure out how DYNAMICS_DATA can be defined twice.&amp;nbsp; If I remove DYNAMICS_DATA from the&amp;nbsp;SUBMODULE (DYNAMICS_DATA:TIMEHISTORY_DATA) NONLINEAR statement I get the expected error #8765 Error in opening the compiled ancestor module file [TIMEHISTORY_DATA].&amp;nbsp; I am hoping that perhaps someone may have run into this as well previously and may have some ideas on where to look for the cause of the error.&amp;nbsp; Would the problem more likely be within MODULE DYNAMICS_DATA or within SUBMODULE TIMEHISTORY_DATA?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 16:39:33 GMT</pubDate>
    <dc:creator>Bill1</dc:creator>
    <dc:date>2020-09-30T16:39:33Z</dc:date>
    <item>
      <title>Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213510#M152046</link>
      <description>&lt;P&gt;I am attempting to learn about and use modules and submodules as part of modernizing a very large FORTRAN 77 project and have run into the following linking error that I cannot figure out:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bill1_0-1601400658448.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/12939i501C26FE00ED23F3/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Bill1_0-1601400658448.png" alt="Bill1_0-1601400658448.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I attempted to create a small sample that would replicate the problem, but of course this sample compiled fine.&amp;nbsp; &amp;nbsp;This is the sample showing the module and submodules that I am trying to set up:&lt;/P&gt;
&lt;P&gt;Main Program File:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PROGRAM MODTEST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; USE DYNAMICS_DATA&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; IMPLICIT NONE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; INTEGER(4) IDUM(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; IDUM = 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; CALL DYN_IN(IDUM)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; STOP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;END&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Module File:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; MODULE DYNAMICS_DATA&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; IMPLICIT NONE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; INTERFACE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; MODULE SUBROUTINE ASSEM_TIME_HIST(LINIT, ILINEAR, TBEG, TEND,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TINC, NTER, INITIALD, ISTEP, TLAST, NTOTAL,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MAX_MODE, RAL1, RAL2, IGDAMP, *)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: LINIT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: ILINEAR&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: INITIALD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: ISTEP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: NTOTAL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: NTER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: MAX_MODE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: IGDAMP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: TBEG, TEND, TINC&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: TLAST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: RAL1, RAL2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; END SUBROUTINE ASSEM_TIME_HIST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; END INTERFACE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CONTAINS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; SUBROUTINE DYN_IN(IDUM)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: IDUM(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4) ILINEAR, LINIT, MAX_MODE, NTER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4) :: ISTEP = 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4) :: INITIALD = 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4) :: NTOTAL = 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4) :: IGDAMP = 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8) TBEG, TEND, TINC, TLAST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8) RAL1, RAL2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; IDUM(1) = 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; CALL ASSEM_TIME_HIST(LINIT,ILINEAR,TBEG,TEND,TINC,NTER,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INITIALD, ISTEP, TLAST, NTOTAL,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX_MODE, RAL1, RAL2, IGDAMP, *9930)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;9930 RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; END SUBROUTINE DYN_IN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;END MODULE DYNAMICS_DATA&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Submodule1 file:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; SUBMODULE (DYNAMICS_DATA) TIMEHISTORY_DATA&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; IMPLICIT NONE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; INTERFACE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; MODULE SUBROUTINE WIL_THE_NON(TBEG, TEND, TINC, NTER, MDISP,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AK, AM, KM, KUL, AC, D, THETA,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ND, NS, NT, NBW,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TOLERANCE, MAXITER, MINITER, ASSEMITER, RELAXATION,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RAL1, RAL2, KSW,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INITIALD, ISTEP, TLAST, NTOTAL)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: ND, NS, NT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: NBW&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: NTER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: MAXITER, MINITER, ASSEMITER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: MDISP(1,12)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: NTOTAL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: KSW(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: INITIALD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: ISTEP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: TBEG, TEND, TINC&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: TOLERANCE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: AM(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: AK(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: RAL1, RAL2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: D(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: THETA&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: AC(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: KM(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: KUL(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: RELAXATION&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: TLAST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; END SUBROUTINE WIL_THE_NON&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; END INTERFACE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CONTAINS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; MODULE SUBROUTINE ASSEM_TIME_HIST(LINIT, ILINEAR, TBEG, TEND,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TINC, NTER, INITIALD, ISTEP, TLAST, NTOTAL,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MAX_MODE, RAL1, RAL2, IGDAMP, *)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: LINIT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: ILINEAR&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: INITIALD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: ISTEP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: NTOTAL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: NTER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: MAX_MODE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: IGDAMP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: TBEG, TEND, TINC&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: TLAST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: RAL1, RAL2&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; END SUBROUTINE ASSEM_TIME_HIST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;END SUBMODULE TIMEHISTORY_DATA&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Submodule2 file:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt; SUBMODULE (DYNAMICS_DATA:TIMEHISTORY_DATA) NONLINEAR&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; IMPLICIT NONE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CONTAINS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; MODULE SUBROUTINE WIL_THE_NON(TBEG, TEND, TINC, NTER, MDISP,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AK, AM, KM, KUL, AC, D, THETA,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ND, NS, NT, NBW,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TOLERANCE, MAXITER, MINITER, ASSEMITER, RELAXATION,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RAL1, RAL2, KSW,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;$&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INITIALD, ISTEP, TLAST, NTOTAL)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: ND, NS, NT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: NBW&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: NTER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: MAXITER, MINITER, ASSEMITER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(IN) :: MDISP(1,12)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: INITIALD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(INOUT) :: ISTEP&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: NTOTAL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; INTEGER(4), INTENT(OUT) :: KSW(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: TBEG, TEND, TINC&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: TOLERANCE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: RELAXATION&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: TLAST&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: AM(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: AK(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(IN) :: RAL1, RAL2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: D(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: THETA&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: AC(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(OUT) :: KM(1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; REAL(8), INTENT(INOUT) :: KUL(1)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; END SUBROUTINE WIL_THE_NON&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;END SUBMODULE NONLINEAR&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I searched the solution for DYNAMICS_DATA to make sure it was not duplicated somewhere and cleaned and rebuilt the solution multiple times with no success.&amp;nbsp; Does anyone have any idea on what else I can do to find the cause of the linker error LNK2005?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:24:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213510#M152046</guid>
      <dc:creator>Bill1</dc:creator>
      <dc:date>2020-09-29T18:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213690#M152055</link>
      <description>&lt;P&gt;Dear Bill, I put your code into a VS solution and your code builds fine, if and only if I remove the obsolete &lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/fortran-compiler-developer-guide-and-reference/top/language-reference/program-units-and-procedures/argument-association-in-procedures/alternate-return-arguments.html" target="_self"&gt;alternate return&lt;/A&gt; (this * in parameter list) for PSXE2020u2 (19.1.2, Windows OS). The formal use of submodules is fine as far as I see. I don't know if the alternate return causes the issues. I found no switch for ifort to accept this feature, but that means not, that it does't exist. Maybe it just does not work with submodules. Anyways, alternate return should be avoided IMHO, if you are modernizing.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 07:32:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213690#M152055</guid>
      <dc:creator>Johannes_Rieke</dc:creator>
      <dc:date>2020-09-30T07:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213691#M152056</link>
      <description>&lt;P&gt;Maybe helpful, the VS solution as zip.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 07:35:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213691#M152056</guid>
      <dc:creator>Johannes_Rieke</dc:creator>
      <dc:date>2020-09-30T07:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213704#M152058</link>
      <description>&lt;P&gt;In reply to the OP, I find the structure rather strange particularly nesting submodule with a submodule. The main point of submodules over modules is that it separates the interfaces from the routine so that you avoid dependencies and hence build cascades.&amp;nbsp; The common implementation is a module with (maybe) some global data and a set of interfaces only. The submodules then have contained the routines only.&amp;nbsp; Routines that are only called from within the same submodule do not need interfaces as they are known within that submodule.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:29:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213704#M152058</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-30T08:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213775#M152061</link>
      <description>&lt;P&gt;I took your ZIP file and built it with the current compiler version (19.1.2). It linked without error.&lt;/P&gt;
&lt;P&gt;There's nothing wrong with nesting submodules, and it can be useful.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 13:58:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213775#M152061</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2020-09-30T13:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213777#M152062</link>
      <description>&lt;P&gt;Hi Steve, I've removed the alternate return from the interfaces of the original thread opener's code and converted it to free format. Bill might has encountered a different link error.&lt;/P&gt;
&lt;P&gt;Has you tried to comment these lines in? It was not linking for me with alternate return. Since it's an obsolete feature, I would not expect, that this is tested with submodules nor would I think one should use alternate return in submodules.&lt;/P&gt;
&lt;P&gt;But maybe it's still supported by ifort with an additional switch...&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;MODULE SUBROUTINE ASSEM_TIME_HIST(LINIT, ILINEAR, TBEG, TEND,
$                     TINC, NTER, INITIALD, ISTEP, TLAST, NTOTAL,
$                     MAX_MODE, RAL1, RAL2, IGDAMP, *)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 14:20:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213777#M152062</guid>
      <dc:creator>Johannes_Rieke</dc:creator>
      <dc:date>2020-09-30T14:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213789#M152064</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;There's nothing wrong with nesting submodules, and it can be useful.&lt;/SPAN&gt;" Steve I would agree with that but I didn't say is was wrong. It did think it was odd (strange) within the context of the example used which seems overly complicated and more difficult to follow (IMO). The whole module /submodule structure only has one routine&amp;nbsp; used externally and that one doesn't make use of submodule functionality at all.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 15:00:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213789#M152064</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-30T15:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213796#M152065</link>
      <description>&lt;P&gt;I had missed that the zip wasn't Bill's original code. I took Bill's code as-is (after fixing the issues caused by pasting fixed-form code directly into the forum) - it compiled and linked without error using compiler 19.1.2.&lt;/P&gt;
&lt;P&gt;I must admit that the combination of nested submodules and alternate return gives me the shivers....&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 15:25:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213796#M152065</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2020-09-30T15:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213810#M152066</link>
      <description>&lt;P&gt;Thanks for all of the replies.&amp;nbsp; The actual source code in these subroutines is thousands of lines long (contained in single files), which is why I am trying to split them up.&amp;nbsp; I copied and pasted the interfaces and module subroutine calls into the sample code but this modified code unfortunately does not produce the linker error.&amp;nbsp; I left the alternate return in for now as it does not seem to be the cause of the problem, although I realize it is obsolete.&amp;nbsp; I have struggled for hours trying to figure out how DYNAMICS_DATA can be defined twice.&amp;nbsp; If I remove DYNAMICS_DATA from the&amp;nbsp;SUBMODULE (DYNAMICS_DATA:TIMEHISTORY_DATA) NONLINEAR statement I get the expected error #8765 Error in opening the compiled ancestor module file [TIMEHISTORY_DATA].&amp;nbsp; I am hoping that perhaps someone may have run into this as well previously and may have some ideas on where to look for the cause of the error.&amp;nbsp; Would the problem more likely be within MODULE DYNAMICS_DATA or within SUBMODULE TIMEHISTORY_DATA?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 16:39:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213810#M152066</guid>
      <dc:creator>Bill1</dc:creator>
      <dc:date>2020-09-30T16:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Submodule Linking error LNK2005</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213860#M152068</link>
      <description>&lt;P&gt;One way is to have a module with all the interfaces and only interfaces, no contains section. You can then have as many submodules of that module as you want they can all see the interfaces and there are no conflicts. That structure is also quite easy to follow. If you have a submodule routine that uniquely calls some helper routines put them all in the same submodule, they will be a subroutine/functions rather than "module subroutine/function" as no external interface is needed and they will all see implict interfaces to each other within that submodule.&amp;nbsp; Personally I don't like lots of separate files I tend to have a lot of routines of the same tribe in a single submodule file and only have&amp;nbsp; sibling&amp;nbsp; submodules if it gets to more than say 10000 lines of code.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 19:03:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Submodule-Linking-error-LNK2005/m-p/1213860#M152068</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-30T19:03:04Z</dc:date>
    </item>
  </channel>
</rss>

