- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a variable inside a fortran module that I would like to define based on a defined variable:
module xyz
#if defined BUFSIZE
#define NMWords BUFSIZE
#else
#define NMWords 20
#endif
integer :: NMW = NMWords
end module xyz
Is this legal? In the makefile for this module, I have defined BUFSIZE. When I run this code, NMWords always is 20, even though BUFSIZE should be defined. Any help appreciated!
Never mind. I found the problem. This is legal.
module xyz
#if defined BUFSIZE
#define NMWords BUFSIZE
#else
#define NMWords 20
#endif
integer :: NMW = NMWords
end module xyz
Is this legal? In the makefile for this module, I have defined BUFSIZE. When I run this code, NMWords always is 20, even though BUFSIZE should be defined. Any help appreciated!
Never mind. I found the problem. This is legal.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to hear you figured it out.

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