Cannot use macro in include '***.***'

Cannot use macro in include '***.***'

Deleted user's picture

I needs to use macro to redirect formatted write() to a all. It's OK when I put macro directly on the top of my source code. Because these large amount of macro need to be appeared in every file of my project, so I am trying to use comma in my source file to make it simple. Now the problem happens when the source code is complied.

In the source code, I have a sentence:


the contents in zzz.for are like:

 
#define WriteWinNF1(v1) if(nout.eq.nscr) then;WriteWinF1(v1);else;write(nout,*) v1;endif 
#define WriteWinNF2(v1,v2) if(nout.eq.nscr) then;WriteWinF2(v1,v2);else;write(nout,*) v1,v2;endif 
#define WriteWinNF3(v1,v2,v3) if(nout.eq.nscr) then;WriteWinF3(v1,v2,v3);else;write(nout,*) v1,v2,v3;endif 
#define WriteWinNF4(v1,v2,v3,v4) if(nout.eq.nscr) then;WriteWinF4(v1,v2,v3,v4);else;write(nout,*) v1,v2,v3,v4;endif 
#define WriteWinNF6(v1,v2,v3,v4,v5,v6) if(nout.eq.nscr) then;WriteWinF6(v1,v2,v3,v4,v5,v6);else;write(nout,*) v1,v2,v3,v4,v5,v6;endif 



There is no problem when the zzz.for is complied independently. But the original source has problem when been compiled.

Can some body provide some ideas?
Thank you in advance.
Jack

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

See if this Knowledge Base article helps.

Steve

Steve
Deleted user's picture

Thanks Steve,
That artical only solves the problem of using macro, my question is how to put a groups of macros in a single file and include that file in other files.

Steve Lionel (Intel)'s picture

Ah. You must use #include, not INCLUDE, for this. You need the macros to be seen by fpp, the preprocessor, and it will process only #include directives.

Steve

Steve

Login to leave a comment.