|
[Sponsors] |
September 21, 2006, 16:44 |
How to compile this kind of code
|
#1 |
Guest
Posts: n/a
|
Hi, Guys
How to compile the following fortran code by f77 Program 'test' # include "head1.h" # include "head2.h" a=1 b=2 c=3 call test(b, & include "head2.h" end ********************************* subroutine test(1, & include "head2.h" # include "head1.h" print*,a,b,c return end *************************** head1.h includes the following line # define _tes a **************************** head2.h includes the following line # real*8 c |
|
September 21, 2006, 17:08 |
Re: How to compile this kind of code
|
#2 |
Guest
Posts: n/a
|
a interesting thing. a old style of programming. it seems the code is written by mixing languages c and fortran. the main part is coded by f77 except the definition of variables by C language. Since the code never call any C-language subroutine, I really get lost. How to complie this type of codes? any hint would be appreciated.
|
|
September 21, 2006, 18:38 |
Re: How to compile this kind of code
|
#3 |
Guest
Posts: n/a
|
Change the name of the file from program.f to program.F and it will compile on almost all a unix-like systems.
The statements beginning with #include are for the cpp program which is the C pre-processor. Capitalising the extension is the naming convention for first running a program through cpp on unix-like systems. FORTRAN, unlike C, is a portable language and does not understand directories which are different on different systems. Hence FORTRANs include can only look in the same directory as the main file. This is not how include files are usually used for larger programs hence the switch to using cpp for many using unix-like systems. |
|
September 21, 2006, 23:30 |
Re: How to compile this kind of code
|
#4 |
Guest
Posts: n/a
|
Done!thank you very much.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PV3FoamReader compile error.... | PEM_GUY | OpenFOAM Installation | 6 | April 5, 2010 18:22 |
What is the Better Way to Do CFD? | John C. Chien | Main CFD Forum | 54 | April 23, 2001 09:10 |
user friendly cfd code | waqar | Main CFD Forum | 19 | August 18, 2000 17:31 |
own Code vs. commercial code | Bernhard Mueck | Main CFD Forum | 10 | February 16, 2000 11:07 |
State of the art in CFD technology | Juan Carlos GARCIA SALAS | Main CFD Forum | 39 | November 1, 1999 15:34 |