|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Perles75
Joined: 12 May 2011 Posts: 10
|
Posted: Tue Jun 21, 2011 4:51 pm Post subject: compiling ok but function undefined |
|
|
Hello,
I'm not sure if that's something regarding Plato or FTN95, I think it's the first case so I'm writing here, but please correct me in case I'm wrong!
I created a project that involves a main fortran file and a series of other .f files that contain functions used in the main program.
I have no problems in compiling and linking the files (at least it returns no errors). But when I launch the resulting .exe file, when the program encounters the first call function, the run stops with the "Error 112: reference to undefined variable, array element or function result (/UNDEF)".
Does someone have an idea of the reason, or what should I check? I'm still a newbie for FTN95/Plato so think also at stupid explanations
Thanks |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Tue Jun 21, 2011 10:53 pm Post subject: |
|
|
The error report means what is says. You have used a variable before it has been given a value.
If you run the exe using the debugger then it will fail at the first offending line of your program and you will be able to see the variable that has been used before being given a value.
Standard Fortran does not automatically initialise unset values to zero. See also the /ZEROISE option on the FTN95 command line. |
|
Back to top |
|
|
tk
Joined: 20 Jan 2007 Posts: 7 Location: Dublin, Ireland
|
Posted: Fri Jul 01, 2011 10:27 am Post subject: |
|
|
Hmmm.
Yes and no.
The variables may be declared in the sense that they have been declared in the start of the program, e.g. ponzi is declared in this program start.
PROGRAM FRAUD
-----
-----
INTEGER i, j, counter, . . .
REAL acoeff, bcoeff, ccoeff, ponzi . . . .
------
------
Yet we could still have the error that you have found.
The trouble arises if we have an assignment statement below this where we need to use the value of ponzi before we've actually given it a value.
This can happen as a result of an error in a branching statement that causes the program to enter a part of the code which expects us to have already a value within the variable, ponzi.
So, to find the cause of your problem, you need to place print*, <var> statements along the program from the top down and run it.
I''m assuming you've taken a hardcopy listing and work from that rather than off the PC screen . . .
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|