comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Compilation Error: Procedure header must appear first and only once
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Compilation Error: Procedure header must appear first and only once [message #94578 is a reply to message #76737] Fri, 14 July 2017 13:21 Go to previous message
rbruntz is currently offline  rbruntz
Messages: 1
Registered: July 2017
Junior Member
I'll add another possibility for some specific cases, just because this was the first suggestion when I googled the error, so it might help some other people.

I've been running and modifying a program that was written by someone else, many years ago, consisting of numerous procedures spread over several files. Everything was working fine, until I tried to add a new procedure to the end of the main file (which we'll call "main_prog.pro"). I added a simple procedure, but then got the "Procedure header must appear first and only once" error no matter what I did to the program, including deleting and re-typing lines (to remove possible hidden characters), copying the text into nano and TextEdit, to save those versions as plain text files, and writing a new, simple "hello, world" procedure, to replace the one I wanted - but the only way to get the error to go away was to delete or comment out the new procedure. It even compiled fine when I copied it over to the end of one of the other files!

I started deleting lines from one of the copies of the original program (with my new procedure in place after the END statement), to see when it would start compiling, so that I could figure out where the trouble was - and then I realized that "main_prog.pro" had an END statement, but no PRO statement at the beginning! (And it has been like that from the first version I got, and has been working fine all along.) I added "PRO main_prog" at the start of the file, and now the new procedure at the end compiles (and runs) fine.

tldr: Make sure that you have a "PRO (program name)" line at the start of your file. It might compile and run fine without it, but you can't add new procedures (or probably functions) after the END statement without it.

-Robert
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Remote plotting
Next Topic: New behavior of n_elements?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:08:33 PDT 2025

Total time taken to generate the page: 0.00254 seconds