Re: Compilation Error: Procedure header must appear first and onlyonce [message #76709] |
Wed, 29 June 2011 08:16  |
Carsten Lechte
Messages: 124 Registered: August 2006
|
Senior Member |
|
|
Maybe something in the lines preceeding the first error is throwing
IDL off the track. Try deleting as much as possible from that part and
see if the error changes. Put back statements until you have found the
line that causes the eroor. I once had an errant '.' at the end of a
variable name that led to errors much later in the file.
chl
|
|
|
Re: Compilation Error: Procedure header must appear first and onlyonce [message #76710 is a reply to message #76709] |
Wed, 29 June 2011 07:38   |
Maegereg
Messages: 10 Registered: June 2011
|
Junior Member |
|
|
On 6/27/11 3:18PM, Michael Galloy wrote:
> 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.
I've checked the first error in each of the two files- both are syntax errors, and in both cases nothing actually appears wrong. Here's the two errors (error is on third line):
END
'Funct_AIF_Fast': BEGIN
SetTimeCommonBlock,tMargin=ObtainTMargin()+tMargin, tRange=tRange
END
'Funct_Artery_AIF': BEGIN
and
t_time=*(*pState).pt_time
time_courseC=(*(*pState).timecourse)[(*pState).cursorPositio n[0],(*pState).cursorPosition[1],*]
uptake_curve=get_uptake_curve(time_courseC, pState, base_level=base_level)
noise_Level=Calculate_Noise(time_courseC, (*pState).n_base, (*pState).baseStart, (*pState).n_Images-1) ;, df=df)
;save, uptake_curve, t_time, filename='D:\tmp.idl'
Eclipse points out the )+ (of the tMargin=ObtainTMargin()+tMargin part), and the =b (of the base_level=base_level part). Neither of them seems to be a syntax error, though do correct me if I'm wrong. There are a ton more of these correct syntax errors scattered throughout the rest of the project.
I also checked the end statements for both of the files. I made a couple changes where it seemed like the wrong end had been used, but even now that the ends are completely correct, the errors persist. Another thing I did notice: eclipse is giving me errors of the form: "Type of end does not match statement" in the functions immediately before I start getting the procedure header errors. I've double checked these functions though, and the ends are correct. And I've also tried just blindly doing what the compiler says to make those bug reports go away (changing the ends to whatever it suggests, even if it's incorrect), but that didn't fix anything either.
|
|
|
|
|
|
|
Re: Compilation Error: Procedure header must appear first and onlyonce [message #76807 is a reply to message #76710] |
Wed, 29 June 2011 09:30   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 6/29/11 8:38 AM, Maegereg wrote:
> On 6/27/11 3:18PM, Michael Galloy wrote:
>> 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.
>
> I've checked the first error in each of the two files- both are syntax errors, and in both cases nothing actually appears wrong. Here's the two errors (error is on third line):
>
> END
> 'Funct_AIF_Fast': BEGIN
> SetTimeCommonBlock,tMargin=ObtainTMargin()+tMargin, tRange=tRange
> END
> 'Funct_Artery_AIF': BEGIN
>
> and
> t_time=*(*pState).pt_time
> time_courseC=(*(*pState).timecourse)[(*pState).cursorPositio n[0],(*pState).cursorPosition[1],*]
> uptake_curve=get_uptake_curve(time_courseC, pState, base_level=base_level)
> noise_Level=Calculate_Noise(time_courseC, (*pState).n_base, (*pState).baseStart, (*pState).n_Images-1) ;, df=df)
> ;save, uptake_curve, t_time, filename='D:\tmp.idl'
>
> Eclipse points out the )+ (of the tMargin=ObtainTMargin()+tMargin part), and the =b (of the base_level=base_level part). Neither of them seems to be a syntax error, though do correct me if I'm wrong. There are a ton more of these correct syntax errors scattered throughout the rest of the project.
These errors are usually indicative that you think you are calling a
function, but IDL thinks you are indexing an array. I would use
"compile_opt strictarr" at the beginning of each routine *and* only use
square brackets to index the array.
> I also checked the end statements for both of the files. I made a couple changes where it seemed like the wrong end had been used, but even now that the ends are completely correct, the errors persist. Another thing I did notice: eclipse is giving me errors of the form: "Type of end does not match statement" in the functions immediately before I start getting the procedure header errors. I've double checked these functions though, and the ends are correct. And I've also tried just blindly doing what the compiler says to make those bug reports go away (changing the ends to whatever it suggests, even if it's incorrect), but that didn't fix anything either.
I still think there is something screwed up there based on the
"Procedure header must appear first and only once", Carsten's suggestion
to remove a enough code for it to work and add back a little at a time
is good.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|
Re: Compilation Error: Procedure header must appear first and onlyonce [message #93346 is a reply to message #76710] |
Mon, 20 June 2016 11:46  |
jaromrnelson
Messages: 2 Registered: June 2016
|
Junior Member |
|
|
I know this question is very old, but this was an error I was getting, and I could not find the solution. I eventually found in my case that this error was caused by a non-printed non-ASCII character at the beginning of the file. After copying the text and saving as a new file (fortuitously without the rogue character) the error disappeared. Subsequent comparisons between the two files revealed the error.
Posting here since this is high on the results lists in internet searches for this error message.
Jarom
On Wednesday, June 29, 2011 at 7:38:43 AM UTC-7, Maegereg wrote:
> On 6/27/11 3:18PM, Michael Galloy wrote:
>> 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.
>
> I've checked the first error in each of the two files- both are syntax errors, and in both cases nothing actually appears wrong. Here's the two errors (error is on third line):
>
> END
> 'Funct_AIF_Fast': BEGIN
> SetTimeCommonBlock,tMargin=ObtainTMargin()+tMargin, tRange=tRange
> END
> 'Funct_Artery_AIF': BEGIN
>
> and
> t_time=*(*pState).pt_time
> time_courseC=(*(*pState).timecourse)[(*pState).cursorPositio n[0],(*pState).cursorPosition[1],*]
> uptake_curve=get_uptake_curve(time_courseC, pState, base_level=base_level)
> noise_Level=Calculate_Noise(time_courseC, (*pState).n_base, (*pState).baseStart, (*pState).n_Images-1) ;, df=df)
> ;save, uptake_curve, t_time, filename='D:\tmp.idl'
>
> Eclipse points out the )+ (of the tMargin=ObtainTMargin()+tMargin part), and the =b (of the base_level=base_level part). Neither of them seems to be a syntax error, though do correct me if I'm wrong. There are a ton more of these correct syntax errors scattered throughout the rest of the project.
>
> I also checked the end statements for both of the files. I made a couple changes where it seemed like the wrong end had been used, but even now that the ends are completely correct, the errors persist. Another thing I did notice: eclipse is giving me errors of the form: "Type of end does not match statement" in the functions immediately before I start getting the procedure header errors. I've double checked these functions though, and the ends are correct. And I've also tried just blindly doing what the compiler says to make those bug reports go away (changing the ends to whatever it suggests, even if it's incorrect), but that didn't fix anything either.
|
|
|