"Duplicate Definition" in QB.EXE; "Equals Missing" in BC.EXE (32149)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q32149

SUMMARY

If a line of code in the QuickBasic editor begins with two occurrences of the same nonreserved word, the second word will be correctly flagged as a "Duplicate definition" when either the Start or Make EXE File command is chosen on the Run menu. If the same word is used as a variable elsewhere in the program, it will give a "Duplicate definition" error at that occurrence of the word.

To generate the "Duplicate definition" message, enter "a a" in the QuickBasic editor, then choose Start on the Run menu. Please note that the line "a a" generates a different message, "Equal sign missing," when compiled with BC.EXE.

The "Duplicate definition" message occurs because the editor assumes the first "a" to be the name of a SUBprogram and the second "a" to be a parameter to be passed to the SUBprogram. Routines and variables must have different names.

MORE INFORMATION

The following code example produces a "Duplicate definition" error on the second "a":
   a a
				
The following code example produces a "Duplicate definition" error on the first line:
   a = 1
   a a
				

Modification Type:MinorLast Reviewed:1/9/2003
Keywords:KB32149