- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I would like to create a program with #ifdef and #endif compilation options but I do not know how could i compile even tis simple hello program:
PROGRAM HELLO IMPLICIT NONE #ifdef PARALLEL WRITE(*,*) 'OPTION A' #endif WRITE(*,*) 'OPTION A+B' END PROGRAM
When I compile, I get this error:
hello.f90(4): warning #5117: Bad # preprocessor line #ifdef PARALLEL -^ hello.f90(6): warning #5117: Bad # preprocessor line #endif
Can someone explain me how to compile and activate or not activate options A and B.
Really Really thanks
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unlike C/C++, standard Fortran doesn't have a built-in preprocessor.
On your compilation line, add the command line switch "-fpp", as:
ifort -fpp myfile.f
and then you should get option "A+B".
or
ifort -fpp -DPARALLEL myfile.f
and you should get option A
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to what Lorri said, changing the file extension to .F90 will set -fpp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
thanks a lot for your suggestions, It saves to me a lot of time.
Thanks again

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