| New Reply |
#ifndef statement in Fortran |
Share Thread |
| Oct17-11, 03:49 AM | #1 |
|
|
#ifndef statement in Fortran
Hi all
I'm using Fortran code written by someone else, and a lot of the files have #ifndef statements in them. For example: Code:
#ifndef global
REAL array(2500)
#endif
Many thanks. |
| Oct17-11, 04:57 AM | #2 |
|
|
kinda a shot in the dark,
but maybe ifndef = if not defined? like python |
| Oct17-11, 05:51 AM | #3 |
|
Mentor
|
The #ifdef and `#endif are C preprocessor statements. Your Fortran code apparently is being passed through the C preprocessor before being compiled as Fortran. Wikipedia article on the C preprocessor: http://en.wikipedia.org/wiki/C_preprocessor.
|
| Oct17-11, 06:40 AM | #4 |
Recognitions:
|
#ifndef statement in FortranIt could be defined earlier in the source code with a statement like #define global or more likely it would be passed to the compiler from the makefile with an option like -Dglobal either in the makefile itself, or on the command line when you run make. As DH said, see the documentation for the C preprocessor, and also for your version of make. |
| Oct17-11, 10:41 AM | #5 |
|
|
I'll go and check out all this preprocessor stuff in more detail. I don't know what I'd do without the helpful folks here at PF!
|
| New Reply |
Similar discussions for: #ifndef statement in Fortran
|
||||
| Thread | Forum | Replies | ||
| FORTRAN 77 read statement | Engineering, Comp Sci, & Technology Homework | 4 | ||
| Goto statement, mostly regarding Fortran | Programming & Comp Sci | 17 | ||
| FORTRAN Write Statement Issue | Programming & Comp Sci | 2 | ||
| meaning for fortran statement | Programming & Comp Sci | 1 | ||
| Fortran 90 very basic question : else if statement | Programming & Comp Sci | 6 | ||