KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q25998: "Duplicate Definition" with Same Name of SUBprogram, Variable

Article: Q25998
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | B_BasicCom | mspl13_basic
Last Modified: 7-FEB-1989

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.

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

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.