Re: Compilation Error: Procedure header must appear first and only once [message #76736] |
Mon, 27 June 2011 14:18 |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 6/27/11 2:38 PM, Maegereg wrote:
> I've been trying to get someone else's program written in IDL 6.4 to
> compile in IDL 8.0. I don't have any previous experience with the
> language, and my C/Python experience is proving a poor substitute to
> expert knowledge. I'm running into the most curious compiler error in
> two of my files. I can't put the full code up here (to begin, between
> the two there are probably 3000 lines), but I'll try to describe
> things as best I can. It's fairly simple: in both of the files, all
> the procedures and functions defined past a certain point produce the
> following error on compilation:
> "% Procedure header must appear first and only once: ANALYZE _ROI_DATA
> At:..." (for example). Every function and procedure that's later in a
> file than a function or procedure that's got that error gets it too.
> And if you were wondering about functions getting an error about
> procedures, the functions all also get "Return statement in procedures
> can't have values." I've been able to fix it by rearranging the
> functions/procedures in a file (worked on one of the two files,
> haven't tried it on the other), but I understand there are good
> reasons to leave the command procedures/functions at the end of the
> file.
>
> I've checked a number of possibilities: these aren't already defined
> in the IDL libraries. I checked the procedures immediately before the
> first erroneous procedure in both files, and all the begin statements
> (and equivalents) seem to have corresponding end statements. The
> program compiles fine in IDL 6.4 (I don't have a copy of 6.4, but I've
> seen this program run, and have used it myself). I'm just about at the
> end of things I can think of to try to fix this. Anyone have any
> suggestions?
1. Always check the first error in the file, a single syntax error can
cause many later error messages.
2. "Procedure header must appear first and only once" almost always
means you forgot to END something -- you have a BEGIN but no END for an
IF statement, a FOR loop, etc.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|