DEFINT A: DEFLNG B Before SUB Gives "Cannot Precede SUB" in QB (63008)






This article was previously published under Q63008

SYMPTOMS

Placing two DEFtype statements (DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR, or DEFCUR) on the same line separated by a colon incorrectly gives the error "Statement cannot precede SUB/FUNCTION definition" in QB.EXE and "Invalid statement preceding SUB/FUNCTION definition" in QBX.EXE. The BC.EXE compiler correctly compiles this line without error.

To work around this problem, place each DEFtype on a separate line before the SUB/FUNCTION line.

STATUS

Microsoft has confirmed this to be a bug in the QB.EXE environment of Microsoft QuickBasic versions 4.00, 4.00b, and 4.50; in the QB.EXE environment of Microsoft Basic Compiler versions 6.00 and 6.00b for MS-DOS (buglist6.00, buglist6.00b); and in the QBX.EXE environment of Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS (buglist7.00, buglist7.10). We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

To reproduce this problem, add the following line before any SUB or FUNCTION in the QB.EXE or QBX.EXE environment:
   DEFINT A:DEFLNG B
				
The resulting SUB will appear as follows:
   DEFINT A:DEFLNG B
   SUB test
   ...
   END SUB
				
To work around this problem, enter each DEFtype as a separate line, as follows:
   DEFINT A
   DEFLNG B
   SUB test
   ...
   END SUB
				
Note that if you load a program resembling this into the QB.EXE or QBX.EXE editor, the editor will automatically put each DEFtype statements on its own line and remove the colon.

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