<?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 $if def statements in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756257#M11744</link>
    <description>I can't say without seeing the actual code you're trying and the commands you're using. Try building the attached program on the different platforms with just "ifort platform.f90" and run it. What do you get?</description>
    <pubDate>Wed, 14 Sep 2011 19:23:37 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2011-09-14T19:23:37Z</dc:date>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756250#M11737</link>
      <description>I have my coding setup to check and see if I am using windows or linux, but what about Mac.&lt;DIV&gt;THis is what I have for windows and linux tests.&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]$if def,msnt (for windows)
.....
$endif

$if -def,msnt (for linux)
.....
$endif[/bash]&lt;/PRE&gt; &lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Jun 2011 23:50:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756250#M11737</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-06-24T23:50:49Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756251#M11738</link>
      <description>Well, that won't work on any platform for Intel Fortran. Here's what will:&lt;BR /&gt;&lt;BR /&gt;!DEC$ IF DEFINED(_WIN32)&lt;BR /&gt;... ! Windows&lt;BR /&gt;!DEC$ ELSE IF DEFINED (__linux__)&lt;BR /&gt;... ! Linux&lt;BR /&gt;!DEC$ ELSE IF DEFINED (__APPLE__)&lt;BR /&gt;... ! Mac OS&lt;BR /&gt;!DEC$ ELSE&lt;BR /&gt;... Error&lt;BR /&gt;!DEC$ END IF&lt;BR /&gt;&lt;BR /&gt;See &lt;A target="_blank" href="http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/fortran/lin/bldaps_for/common/bldaps_use_presym.htm"&gt;here &lt;/A&gt;for all the predefined symbols.</description>
      <pubDate>Sat, 25 Jun 2011 03:17:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756251#M11738</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-06-25T03:17:45Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756252#M11739</link>
      <description>&lt;PRE&gt;[bash]So I added the DEC DEFINE lines, but when I compile on linux, it is pulling in the options for _win32.[/bash]&lt;/PRE&gt;&lt;PRE&gt;[bash]If I add to the compiler lie -D_linux_, it pulls in all options for Windows, Linux, and Apple.[/bash]&lt;/PRE&gt;&lt;PRE&gt;[bash]&lt;BR /&gt;[/bash]&lt;/PRE&gt;&lt;PRE&gt;[bash]*mlist
       subroutine nlssrv
!      This is the subroutine for licensing RELAP
!      Created by: Brian Allison
!
$if def,msnt
       use dflib
$if def,ifortc,1
       use ifport, only: system
$endif
!
       use ufilef
!
       implicit none
$if def,msnt
!dec$ attributes dllimport :: ValidateDLL, CheckLicense
!dec$ attributes dllimport :: InstallLicense, DisplayInstallationID
$endif
!
       logical exis
       integer is, iargc, irc, irc2, irc3, irc4, irc5, irc6, irn, ln2
       integer(4) ValidateDLL, CheckLicense, DisplayInstallationID,
     &amp;amp; InstallLicense
$if -def,msnt 
      integer(4) system
$endif
       character id*12, lcns*22, ln1*18
       character :: syscall1*35 = "nilm -l /usr/lib/libFileMgmt.so -G "
!
!DEC$ IF DEFINED(_WIN32)
!DEC$ ATTRIBUTES ALIAS:'_ValidateDLL' :: ValidateDLL
!DEC$ ATTRIBUTES ALIAS:'_CheckLicense' :: CheckLicense
!DEC$ ATTRIBUTES ALIAS:'_DisplayInstallationID' :: DisplayInstallationID
!DEC$ ATTRIBUTES ALIAS:'_InstallLicense' :: InstallLicense
!DEC$ ATTRIBUTES ALIAS:'_StartTheService' :: StartTheService
!DEC$ ELSE IF DEFINED (__linux__)
!DEC$ ATTRIBUTES ALIAS:'ValidateDLL' :: ValidateDLL
!DEC$ ATTRIBUTES ALIAS:'CheckLicense' :: CheckLicense
!DEC$ ATTRIBUTES ALIAS:'DisplayInstallationID' :: DisplayInstallationID
!DEC$ ATTRIBUTES ALIAS:'InstallLicense' :: InstallLicense
!DEC$ ELSE IF DEFINED (__APPLE__)
!DEC$ ATTRIBUTES ALIAS:'_ValidateDLL' :: ValidateDLL
!DEC$ ATTRIBUTES ALIAS:'_CheckLicense' :: CheckLicense
!DEC$ ATTRIBUTES ALIAS:'_DisplayInstallationID' :: DisplayInstallationID
!DEC$ ATTRIBUTES ALIAS:'_InstallLicense' :: InstallLicense
!DEC$ END IF
!
!  Check license.
!DEC$ IF DEFINED(_WIN32)
         call StartTheService
!DEC$ END IF
!      Random Number
         irn = 12
         irc3 = ValidateDLL (3009, 9445, irn)
         irc = CheckLicense (irn)
         irc2 = DisplayInstallationID (id)
         write (tty,"('License Status:',i10)") irc
         write (tty,"('Installation ID:',a13)") id
!DEC$ IF DEFINED(_linux_)
         irc5 = system("nilm -l /usr/lib/libFileMgmt.so -I")
!DEC$ END IF
!DEC$ IF DEFINED(_linux_)
         if (irc .eq. -4) then
           is = 0
           do
             write (tty,"('E-mail the Installation ID, found on this scr
     &amp;amp;een to issnet@cableone.net.'/'Please key in the 15 digit unlock co
     &amp;amp;de that you recieved in your e-mail'/'after sending in the Install
     &amp;amp;ation ID.'/)")
             read (5,"(a)") ln1 !15 character unlock code
             ln2 = len_trim(ln1) !Measure the length of the unlcok code
             if (ln2 .ne. 15) then
               write (tty,"('15 character unlock code was not entered
     &amp;amp;.')")
             else 
               irc6 = system(syscall1//ln1)
               if (irc .lt. 0) then
                 write (tty,"('License Status:', i10)") irc
                 stop "Unlock code was incorrect"
               exit
             endif
             is = is + 1
             if (is .lt. 3) cycle
             stop 'Unlock code was not entered properly.'
           enddo
           stop
         endif
!DEC$ END IF
!DEC$ IF DEFINED(_WIN32)
         inquire (file="licensedata.txt",exist=exis)
         if (exis) then
           open (unit=output,file="licensedata.txt",status='old',
     &amp;amp;     form='formatted')
           close (output, dispose='delete')
         endif
!DEC$ END IF
         lcns = " "
         irc4 = InstallLicense (lcns)
!DEC$ IF DEFINED(_WIN32)
         if (irc .lt. 0) then
           write (tty,"('Problewm with license!  Please contact Innovati
     &amp;amp;ve Systems software with error code and installation id.'/'issnet@
     &amp;amp;cableone.net')")
           stop 
         endif
!DEC$ END IF
         if (irc .eq. 10000) then
           write (tty,"(' LicenseStatus: License is active')")
         endif
         if (irc .eq. -108) then
           write (tty,"(' RELAP5 folder must have full administrative ri
     &amp;amp;ghts')")
         endif
         if (irc.lt.365 .and. irc.gt.0) then
           write (tty,"(' LicenseStatus:',i10,' Days left')") irc
         endif
!
       end subroutine nlssrv[/bash]&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Sep 2011 17:25:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756252#M11739</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T17:25:05Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756253#M11740</link>
      <description>You should not add -D for the platform names - these are predefined by the compiler. Did you leave in those $if lines?</description>
      <pubDate>Wed, 14 Sep 2011 17:32:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756253#M11740</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-14T17:32:46Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756254#M11741</link>
      <description>Are you referring to these:&lt;DIV&gt;&lt;OL start="1" class="dp-sh"&gt;&lt;LI class="alt"&gt;$ifdef,msnt(forwindows)&lt;/LI&gt;&lt;LI&gt;.....&lt;/LI&gt;&lt;LI class="alt"&gt;$endif&lt;/LI&gt;&lt;LI&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;$if-def,msnt(forlinux)&lt;/LI&gt;&lt;LI&gt;.....&lt;/LI&gt;&lt;LI class="alt"&gt;$endif&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;SPAN style="line-height: 16px;"&gt;I took them out. Also, linux and apple are not defined. THe manual says that you have to define them at the start of compilation.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Sep 2011 17:49:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756254#M11741</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T17:49:11Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756255#M11742</link>
      <description>You should not define the linux and apple symbols (nor WIN32). The compiler supplies the appropriate definition depending on the platform you compile on.</description>
      <pubDate>Wed, 14 Sep 2011 18:16:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756255#M11742</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-14T18:16:24Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756256#M11743</link>
      <description>ok so then why when I compile on linux does it load the win32 items?</description>
      <pubDate>Wed, 14 Sep 2011 19:05:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756256#M11743</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T19:05:56Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756257#M11744</link>
      <description>I can't say without seeing the actual code you're trying and the commands you're using. Try building the attached program on the different platforms with just "ifort platform.f90" and run it. What do you get?</description>
      <pubDate>Wed, 14 Sep 2011 19:23:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756257#M11744</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-14T19:23:37Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756258#M11745</link>
      <description>I typed "ifort platform.f90" on my mac and got new prompt&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Sep 2011 21:34:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756258#M11745</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T21:34:18Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756259#M11746</link>
      <description>Run the resulting program and see what it prints.</description>
      <pubDate>Wed, 14 Sep 2011 21:57:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756259#M11746</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-09-14T21:57:17Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756260#M11747</link>
      <description>what resulting program? It did not create any new files. all there is is platform.f90.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;oh wait there is a file called a.out.&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Sep 2011 22:13:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756260#M11747</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T22:13:45Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756261#M11748</link>
      <description>OK I figured it out. It says MAC OS!&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;SO why when I run a linux compile program it is using the options under the _win32 decloration?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is it because I am compiling on a virtual Linux machine on my Win 7 computer?&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Sep 2011 22:17:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756261#M11748</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T22:17:07Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756262#M11749</link>
      <description>I just tried platform.f90 on my virtual linux on my mac and it says LINUX</description>
      <pubDate>Wed, 14 Sep 2011 22:19:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756262#M11749</guid>
      <dc:creator>Brian_A_</dc:creator>
      <dc:date>2011-09-14T22:19:38Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756263#M11750</link>
      <description>If it gave anything else, we could conclude that the VM implementation was defective or that you had lost awareness of whether you were running inside the host or the guest OS -- the latter is not plausible since the look-and-feel is quite different between the host and the guest.</description>
      <pubDate>Thu, 15 Sep 2011 08:53:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756263#M11750</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-09-15T08:53:33Z</dc:date>
    </item>
    <item>
      <title>$if def statements</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756264#M11751</link>
      <description>The compiler is what determines the value and it is specific to the target platform of the compiler. It doesn't "detect" the OS.</description>
      <pubDate>Thu, 15 Sep 2011 14:32:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/if-def-statements/m-p/756264#M11751</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-09-15T14:32:37Z</dc:date>
    </item>
  </channel>
</rss>

