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.
29280 Discussions

Fortran Preprocessor ignores defined preprocessor variables in VS IDE?

JantN
Beginner
1,364 Views

I try to compile software, which was developed in Linux, for Windows. It compiles correctly in Linux. The software contains various preprocessor variables. 

An example from the original source code is:

#if (_DP==0)
use iso_fortran_env,only:output_unit,int32,int64,real32,real64,wp=>real32
#else
use iso_fortran_env,only:output_unit,int32,int64,real32,real64,wp=>real64
#endif

The command line in Visual Studio IDE (Microsoft Visual Studio Community 2022 (64-bit);
Version 17.0.5), which summarises my settings, is:

/nologo /debug:full /Od /fpp /DDP /DPARDISO /DSPAINV /warn:interfaces /module:"x64\Debug\\" /object:"x64\Debug\\" /Fd"x64\Debug\vc170.pdb" /traceback /check:bounds /check:stack /libs:static /threads /dbglibs /Qmkl:parallel /c

The i90 file gives:

use iso_fortran_env,only:output_unit,int32,int64,real32,real64,wp=>real32

So, despite using "/fpp /DDP", fpp evaluates the original source code with DP=0. I also tried /DDP=1, but no difference. There are no #DEFINE preprocessor statements in the source code. In fact, all preprocessor variables are taken as 0.

Any suggestions what I am doing wrong? 

Thanks.

0 Kudos
1 Solution
Arjen_Markus
Honored Contributor II
1,360 Views

I think you should use: -D_DP instead of -DDP - see the #if line.

View solution in original post

0 Kudos
3 Replies
Arjen_Markus
Honored Contributor II
1,361 Views

I think you should use: -D_DP instead of -DDP - see the #if line.

0 Kudos
JantN
Beginner
1,354 Views

Thank you. Embarassingly obvious, but I did not see it. And yes, it works.

0 Kudos
Arjen_Markus
Honored Contributor II
1,348 Views

It happens to everyone from time to time :).

0 Kudos
Reply