X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Jun 2011 09:04 AM by  anon
Compilation Error: Procedure header must appear first and only once
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Jun 2011 09:04 AM
    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 functions/procedures aren't already defined in the IDL libraries. I've checked all the end statements in both of the files, and they all appear to be correct. The procedures immediately proceeding the ones that get these errors do have a number of "Type of end does not match statement" errors, but as far as I can tell the ends are correct. And when I tried changing the ends to match what the compiler suggested, the end errors went away, but the procedure header errors remained. I've also checked over the first errors in each of the two files. They're syntax errors, and there doesn't appear to be anything wrong with the syntax. 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?

    Deleted User



    New Member


    Posts:21
    New Member


    --
    29 Jun 2011 10:59 AM
    Hi, It sounds like perhaps it could be a path issue. Is it possible that on IDL 6.4, that some of the routines were defined in separate files, and now in IDL 8.0 it can't find those files? In general, if you use a procedure/function inside a routine, those procedures/functions needs to be defined above that routine - i.e. earlier in the file. I would try splitting the file up into separate pieces, and see if that makes the problem go away. If it is still a problem, maybe you could isolate the problem just down to a few lines of code and post them here. Good luck! -Chris ITTVIS

    Deleted User



    New Member


    Posts:
    New Member


    --
    29 Jun 2011 01:27 PM
    Turns out the problem was solved by adding compile_opt strictarr to functions that had errors.
    You are not authorized to post a reply.