Silverfrost Forums

Welcome to our forums

Conditional compilation with C-style preprocessing

6 Mar 2006 10:28 #561

The FTN95 manual says that C-style preprocessing is available through the /CFPP compiler directive.

However, using FTN95 in the following manner : FTN95 myprog.f /CFPP raises errors concerning the #ifdef and #include statements which are present in the code of myprog.f

How does one use the C-style preprocessor for Fortran source files ?

6 Mar 2006 12:35 #562

Louis

I seem to recall that the documentation appeared in one version of FTN95 before the feature was enabled. I think you should be OK with either version 4.8 or 4.9. This is from memory. I do not have the version log to hand. I have tried with version 4.9 and it is OK.

The range of features is limited and is described in the help file under 'C-Style Conditional Compilation'.

Regards

Paul

6 Mar 2006 11:41 #563

Louis

If you are using /CFPP on the command line then FTN95 should not complain about all of the # statements. Try them one at a time starting with just one #include and an include file that contains no # statements.

As I recall, #define in FTN95 does not work in the same way as C. You must use /VPARAM or /DEFINE on the command line at the same time. I am guessing here but one or two simple trials will verify this.

Regards

Paul

7 Mar 2006 1:39 #564

Louis

A simple example works OK for me but I had to start the # in column 7.

Regards

Paul

18 Mar 2006 4:57 #581

It is possible to use #define within source code and also on the command line as a replacement for /VPARAM.

Please login to reply.