I created two CCL programs ("aprog" and "bprog") and placed them in separate CCL files of the same names ("aprog.ccl" and "bprog.ccl" respectively).
Both programs work correctly by themselves. Then I changed "aprog" to call "bprog" from within the code and I got an error message when I tried to compile my private CCLs: Aprog.ccl 5: Undefined name 'bprog' Aprog.ccl 5: Syntax error near 'arg_1'
What is the problem and how do I correct it? I have called other CCL programs from within a CCL routine and I have not had any problems. Why is this a problem?
Synopsis
Correcting 'Undefined name' error in compilation of CCL filesSolution
This is a very simple problem to fix, but before we describe that, we have to explain exactly why this error occurs. Let's start by clarifying some points:- The name of a CCL file can be different from the name of the CCL program inside of the file. In fact, you can have more than one program (or command) in a CCL file. Actually, you are encouraged to put more than one program in a CCL file if the programs are related (this way similar programs are located in one place for you to find later).
- The error refers to the program name ("bprog") that is not found, but the file name "Aprog.ccl" is also listed in the error message. The number ("5" in this case) tells the line in the "Aprog.ccl" where "bprog" is called. All this information will prove helpful in correcting the problem.
- CCL files are compiled in alphabetical order by file name. The contents of each file are then compiled sequentially. If the CCL compiler finds a reference to a program name before that program has been compiled, the error "Undefined name..." occurs.
- Rename the CCL files in a different alphabetical order so that the file containing "bprog" gets compiled before the file containing "aprog". You can try renaming the "Bprog.ccl" file to "Aaprog.ccl". You do not have to change the names of the individual programs.
- Place the "aprog" and "bprog" programs in the same file and make sure that "bprog" is placed before "aprog" (you will still have the problem if the order of the files is reversed).
- If the above options are difficult to do, you can solve the problem by declaring a "prototype" of "bprog" before "aprog" is defined. An example of this follows: