BC.EXE "Name of Subprogram Illegal" Means Duplicate Definition (71109)






This article was previously published under Q71109

SUMMARY

The BC.EXE compiler mistakenly gives the error message "Name of subprogram illegal" when a program has a SUBprogram and FUNCTION with the same name. The error message is supposed to be "Duplicate Definition".

This information applies to BC.EXE in Microsoft QuickBasic versions 4.00, 4.00b, and 4.50; in Microsoft Basic Compiler versions 6.00 and 6.00b; and in Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10.

MORE INFORMATION

The error message "Name of Subroutine Illegal" occurs when compiling with BC.EXE from outside the QB.EXE or QBX.EXE environment. Inside the QB.EXE or QBX.EXE environment, the correct error message "Duplicate Definition" is displayed.

QuickBasic and Basic require that functions and subprograms have different names. Note that the type identifier %, $, #, !, or & at the end of a function name is not considered part of the function name, but rather tells the compiler what variable type the function returns.

The following sample code demonstrates the incorrect error message:
DECLARE FUNCTION Test% (a$)
DECLARE SUB Test (b$)
				
The BC.EXE compiler will give the error "Name of subprogram illegal" on the second occurrence of the name Test. To eliminate the error message (which is supposed to say "Duplicate Definition"), you must give your subroutines and functions unique names.

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB71109