"Duplicate Definition" with Same Name of SUBprogram, Variable (25998)



The information in this article applies to:

  • Microsoft QuickBASIC 4.5
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.0

This article was previously published under Q25998

SUMMARY

When you run the program below, a "Duplicate definition" occurs because a variable and SUBprogram have the same name, not counting the type of declaration suffix (i.e., !, #, $, &, or %).

You can work around this design limitation by changing the variable name or the subprogram name.

This information applies to QuickBasic Versions 4.00, 4.00b, and 4.50, and the Basic compiler Versions 6.00 and 6.00b.

MORE INFORMATION

The following program demonstrates the "Duplicate Definition" error:
' THIS IS THE MAIN PROGRAM:
DECLARE SUB abc ()
DEFINT A-Z
abc! = 2
CALL abc

SUB abc STATIC
PRINT "hello"
END SUB
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB25998