<?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: Link Problem between Ifort compiled program and g++ in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749128#M6110</link>
    <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;After that others linking problems occur but I manage to solve it when I link the library ifcore and dl.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jul 2008 13:09:18 GMT</pubDate>
    <dc:creator>sphost</dc:creator>
    <dc:date>2008-07-08T13:09:18Z</dc:date>
    <item>
      <title>Link Problem between Ifort compiled program and g++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749126#M6108</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I work on a C++ project and we have to integrate some mathematical Model written in Fortran.&lt;/P&gt;
&lt;P&gt;I compiled this Model with ifort and made an .a file.&lt;/P&gt;
&lt;P&gt;I tried to call this model in my C++ code but during the linkof the .a library with g++ an error occured "Undefined reference to" my Fortran function.&lt;/P&gt;
&lt;P&gt;Do I have to put specific option with ifort and g++in order to able to link correctly ?&lt;/P&gt;
&lt;P&gt;Thanks in advance for your answers.&lt;/P&gt;
&lt;P&gt;Sample code test below :&lt;/P&gt;
&lt;P&gt;Fortran Code :&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="CMTT8" size="5"&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;subroutine &lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="CMTT8" color="#ffffff" size="2"&gt;F1&lt;/FONT&gt;&lt;FONT face="CMTT8" size="5"&gt;&lt;FONT size="2"&gt;(B, D, TAILLE_D) BIND(C, NAME="f1")&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;use, intrinsic :: ISO_C_BINDING&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;implicit none&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;real(C_DOUBLE), intent(inout) :: B&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;real(C_DOUBLE), dimension(*), intent(in) :: D&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;integer(kind=C_LONG), VALUE :: TAILLE_D&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;print *, "B=", B, "D(",TAILLE_D,")=", D(TAILLE_D)&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;end subroutine&lt;/FONT&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="CMTT8" color="#ffffff" size="5"&gt;F1&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="CMTT8" color="#ffffff" size="5"&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="CMTT8"&gt;&lt;FONT color="#000000" size="2"&gt;C++ Code&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="CMTT8" color="#ffffff" size="5"&gt;&lt;FONT face="CMTT8" size="5"&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;void f1( double *b, double d[], long taille_d );&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;main()&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;double beta = 378.0 ;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;double delta[] = { 17., 12.3, 3.14, 2.718, 0.56,&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;22.67, 25.8, 89., 76.5, 80. } ;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;long taille_delta = sizeof delta / sizeof delta[0] ;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;f1( β, delta, taille_delta ) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;return 0;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" size="2"&gt;With this test, I obtain : "Undefined reference to `f1(double*, double*, long)"&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Jul 2008 14:50:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749126#M6108</guid>
      <dc:creator>sphost</dc:creator>
      <dc:date>2008-07-07T14:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Link Problem between Ifort compiled program and g++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749127#M6109</link>
      <description>In your C++ code, you need to write:&lt;BR /&gt;&lt;BR /&gt;extern "C" void f1 (....)&lt;BR /&gt;&lt;BR /&gt;Otherwise C++ name mangling is applied.&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Jul 2008 15:22:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749127#M6109</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-07-07T15:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Link Problem between Ifort compiled program and g++</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749128#M6110</link>
      <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;After that others linking problems occur but I manage to solve it when I link the library ifcore and dl.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jul 2008 13:09:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Link-Problem-between-Ifort-compiled-program-and-g/m-p/749128#M6110</guid>
      <dc:creator>sphost</dc:creator>
      <dc:date>2008-07-08T13:09:18Z</dc:date>
    </item>
  </channel>
</rss>

