- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
#ifdef DEBUG
...
#else
...
#endif
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
#ifdef DEBUG
...
#else
...
#endif

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page