|Jun5-12, 10:25 AM||#1|
Include statement in Fortran
hi all !!
I wanna ask about Include Statement in fortran example: Include 'D:\XXX.f'
in my XXX.f have some subroutines and want to call these subroutine in Main program but i show error . someone does like me can share me some experience !!!
|Jun5-12, 01:17 PM||#2|
Here is a link to some documentation for the Include statement in HP fortran compilers - http://h21007.www2.hp.com/portal/dow...rm/lrm0580.htm.
Show us your code and the error you are getting. Without seeing what you're doing and the error you're getting, it's difficult to give you any specific help.
|Jun5-12, 07:18 PM||#3|
I have never included the drive letter or anything else other than the file name itself into the include statement...typically, you tell the compiler where to find include files via compiler option (-I, I think) and then you simply write "include 'xxx.f' " in your program.
I typically do not use *.f extension on files that are meant to be included into others; instead, I use *.inc, for include. I have my reasons to use a different extension for files to be included...they do not need to be compiled! And so, my make files can tell them apart from the ones with *.f extension that do need to be compiled.
|Jun5-12, 09:58 PM||#4|
Include statement in Fortran
Without seeing the error message, I guess there are two basic options
1. The compiler could't find your file (i.e the file name or directory was wrong, or you forgot to put then name in quotes, or whatever)
2. You are including the contents of the file in the wrong place. For example if you want to include a complete subroutine for some reason, you can't have the suibroutine "nested" insude anouther routine or the main program. The compiler just inserts the contents of the include file at the place where the "include" statement was. It's your responsibility to make sure that produces a valid complete program. The compiler doesn't do any "magic" to sort that out for you.
|Jun6-12, 10:27 PM||#5|
thank everybody !!!
i've set up succesfully my include link. I see that Include statement can put everywhere in my code - it means that when we call include statement with file fortran it will replace the codes in this file.
but i find new problem is transferring data between 2 subroutine in my programme
C Flow variable arrays
I have two subroutine - one is pre-process, one is process. But i must transfer a list of variable which you can see. but it dont run as well as i can. I read in internet, we can use common block but i try but unsuccessful , can help me again my friends ???
thank a lot
|Similar Threads for: Include statement in Fortran|
|Fortran 77 DECK statement||Programming & Comp Sci||6|
|FORTRAN 77 read statement||Engineering, Comp Sci, & Technology Homework||4|
|#ifndef statement in Fortran||Programming & Comp Sci||4|
|Goto statement, mostly regarding Fortran||Programming & Comp Sci||17|
|meaning for fortran statement||Programming & Comp Sci||1|