- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
12 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to type in /fpp:"/m" in the Project Options box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, this is probably a basic thing, but I can't locate the "Projects Option Box". Where is that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Project..Settings..Fortran. Each of the settings pages has a text box Project Options where the equivalent command line options are displayed. You can edit this as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using INCLUDE to reference these .h files or #include? You must use #include otherwise the preprocessor won't see them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And you have /fpp:"/m" under Project Options for the project? It should work. If you need further help, write CVF support at vf-support@hp.com.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thank you for your help though!!!
Brent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Disregard my last post. Something was corrupted and effecting one file. I restarted everything from scratch and itseems to be working now.
Thanks for info.
Ted Z.
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