Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29284 Discussions

How to use #ifdef - #else - #endif in Intel Visual Fortran

acobulareddy
Beginner
3,428 Views

I have the following code in one of my Fortran Program which is working fine in Unix. where as the same code is giving errors while compiling in windows (intel fortran). How to use such statements in Windows

#ifdef BYPASSBUILTDATE

character *10 BUILTDATE/ BYPASSBUILTDATE /
#else
character*7 BUILTDATE/'No date'/
#endif
#ifdef BYPASSVERSION
character*8 VERSION/ BYPASSVERSION /
#else
character*10 VERSION/'No version'/

Thanks,
Chandra.

0 Kudos
2 Replies
GVautier
New Contributor III
3,428 Views

Conditionnal compilation syntax is :

!dec$ if defined(VARIABLE_NAME)

...
!dec$ else

...
!dec$ endif

0 Kudos
Steven_L_Intel1
Employee
3,428 Views

You can use the #if syntax but have to enable the "Fortran Preprocessor" option - it is off by default. /fpp from the command line or the Preprocessor property page in Visual Studio.

0 Kudos
Reply