Preprocessor in #included Files

Steve Kargl sgk@troutmask.apl.washington.edu
Mon Feb 12 21:46:00 GMT 2007


On Mon, Feb 12, 2007 at 03:03:04PM -0600, David Greene wrote:
> 
> Is this a known problem?  Is there a workaround?
> 

There is insufficient data to provide an answer.  If
the offending source code is available, and info about
your system is known, we might be able to help.

Given 

%cat test.h
integer a
#if defined(PROBLEM_A)
parameter(a = 1)
#elif defined(PROBLEM_B)
parameter(a = 2)
#else
#error "Select a problem"
#endif

%cat main.F90
program main
#include "test.h"
print *, a
end program main

troutmask:sgk[235] gfc41 --version
GNU Fortran 95 (GCC) 4.1.2 20070127 (prerelease)

troutmask:sgk[236] gfc42 --version
GNU Fortran 95 (GCC) 4.2.0 20070126 (prerelease)

troutmask:sgk[238] gfc4x --version
GNU Fortran 95 (GCC) 4.3.0 20070212 (experimental)


All compile the above.
-- 
Steve



More information about the Fortran mailing list