Migrating Fortran source code from HPUX to the PC my source code uses cpp syntax for "#include" statements as well as "#if", "#ifdef", "#ifndef", etc. In addition to DVF v6.0, I have Microsoft Visual Studio 6.0 w/ Visual C++ 6.0 installed on my PC. Question: is there a way to invoke the C preprocessor, cpp, to expand source code prior to compulation using DVF?
链接已复制
12 回复数
Yes. In Developer Studio, select Project..Settings..Fortran..Preprocessor..Enable FPP. From the command line, use /fpp. This is a Fortran-friendly version of cpp. Note that macro expansion is disabled by default - you can enable it with /fpp:"/m"
Steve
Steve
I just posted a similar problem to the message board. However, in the Compaq Visual Fortran version 6.6c there is no way to change the FPP to /fpp:"/m". How do you change it on that version? Thanks!
Brent
Thanks. I found that. But it still doesn't work. I'm probably asking the wrong question. Here is what I have:
const.h (This is a file with my #defines)
const1.h
const2.h
A lot of .f90 files
How can I compile my code so that it automatically recognizes and substitutes my macros that are defined in the const.h, const1.h, or const2.h?
I do this now with a C preprocessor that I use before my fortran compiler. Thank you.
Brent
Yes, I am using #include. Here are some snippets from the code:
turb.f90:
#include "const.h" (first line of code)
.
.
.
dtur = DISS_L*l + DISS_M * m (this is where I wanted a replacement from const.h)
const.h:
#define DISS_L 13.45454
#define DISS_M 14.3452
And you have /fpp:"/m" under Project Options for the project? It should work. If you need further help, write CVF support at [email protected].
I am having the same problem. I have added /fpp:"/m" to my project settings. I have changed my include "file.h"to #include "file.h" and I still get the compilation error:
Warning: Bad # preprocessor line
#define doit 952
#define doit 952
running cvf6.6a