- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I use ifort and pgf90, mainly ifort.
I also use preprocessor directives as -D, the problem is that the source code required to use a directive is different between ifort and pgf90.
For instance, ifort needs
!DEC$ IF DEFINED (FOO)
!DEC$ END IF
but pgf90 needs
#ifndef FOO
#endif
Is there a way to have a source code that would compile with both compilers ?
Thx.
I use ifort and pgf90, mainly ifort.
I also use preprocessor directives as -D, the problem is that the source code required to use a directive is different between ifort and pgf90.
For instance, ifort needs
!DEC$ IF DEFINED (FOO)
!DEC$ END IF
but pgf90 needs
#ifndef FOO
#endif
Is there a way to have a source code that would compile with both compilers ?
Thx.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ifort supports the cpp-style directives too. You can add -fpp on the line or name the file with .F or .F90 file types.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many Thx !
It's ok now.
There's only a minor difference, a module which is encapsulated in such a directive won't compile.
I have to put the directive inside the module definition keywords :
does not compile with -fpp style :
#IFDEF FOO
module FOOFOO
...
end module FOOFOO
#ENDIF
this one is ok :
module FOOFOO
#IFDEF FOO
...
#ENDIF
end module FOOFOO
It's ok now.
There's only a minor difference, a module which is encapsulated in such a directive won't compile.
I have to put the directive inside the module definition keywords :
does not compile with -fpp style :
#IFDEF FOO
module FOOFOO
...
end module FOOFOO
#ENDIF
this one is ok :
module FOOFOO
#IFDEF FOO
...
#ENDIF
end module FOOFOO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our compiler does not like it if a source file has no compilable lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But it just works ok with !DEC$ style directives !
Thx again.
Thx again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know. The !DEC$ directives are processed by the compiler directly, whereas the # directives are run through a preprocessor. I'm just explaining what happens, not trying to rationalize it!

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