Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29235 Discussions

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

acobulareddy
Beginner
3,367 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,367 Views

Conditionnal compilation syntax is :

!dec$ if defined(VARIABLE_NAME)

...
!dec$ else

...
!dec$ endif

0 Kudos
Steven_L_Intel1
Employee
3,367 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