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

debug source colour and compilation dependent on

skinner__karl
New Contributor I
666 Views

Hi,
my debug lines (column 1 = "D") in source code appear green in Visual Studio, and so can easily be overlooked as comment lines. Is there a way to have them black in Debug configuration and green in the release version? (ifcompiler option /nod_lines is set)


Or is there a way to have conditional compilation dependent on release/debug configuration, I looked but could not find a compiler directive.

eg.
#if release_version then
. . .
#endif

#ifdebug_version then

. . .

#endif

thanks in advance
karl skinner

0 Kudos
1 Solution
Steven_L_Intel1
Employee
666 Views
I will also comment that "D lines" are for fixed-form source only, which I don't recommend using in new development. Les shows one way to do it - you can also use the cpp style # directives if you enable preprocessing using the same property page Les pointed you to. Then it would be:

#ifdef DEBUG
...
#else
...
#endif

View solution in original post

0 Kudos
2 Replies
Les_Neilson
Valued Contributor II
666 Views
In Visual Studio for the debug configuration
Project Properties -> Fortran -> Preprocessor -> Preprocessor Definitions
Enter DEBUG

then in your code
!DEC$IF DEFINED(DEBUG)
some debug code
!DECELSE ! optional
some release code ! optional
!DEC ENDIF

Very useful for example for writing debug information to a file

Les
0 Kudos
Steven_L_Intel1
Employee
667 Views
I will also comment that "D lines" are for fixed-form source only, which I don't recommend using in new development. Les shows one way to do it - you can also use the cpp style # directives if you enable preprocessing using the same property page Les pointed you to. Then it would be:

#ifdef DEBUG
...
#else
...
#endif
0 Kudos
Reply