Microsoft KB Archive/33142

= Offset for Jump To... Option Appears Incorrect after $INCLUDE =

Article ID: 33142

Article Last Modified on 11/21/2006



This article was previously published under Q33142



SUMMARY
In the QuickBASIC Interpreter, the Jump To... option goes to a physical line offset from the beginning of the file, excluding the extra lines in the compiler's $INCLUDE files (if any).

However, when an error occurs in a compiled program, the number of the line in error counts the lines in $INCLUDE files. This applies to error line numbers shown in the Program Listing File, or in the run-time error message &quot;***** Error  at &quot; (which requires the &quot;Process Runtime Events&quot; compiler option to get a line number).

Thus, if the main source file contains REM $INCLUDE or '$INCLUDE statements, the Jump To... option in the interpreter will not show you the proper line in the main program where the error occurred. This is because the compiler counts the lines in the $INCLUDE files when figuring the offset, while the interpreter environment does not.

To calculate the correct offset, subtract the number of lines in the $INCLUDE files from the given error offset. Then select Jump To... from the Search menu and use the smaller offset.



MORE INFORMATION
When a compile-time error occurs in a compiled program's $INCLUDE file itself, the interpreter improperly puts a box around a line in the main program. The number of lines that this box lies below the REM $INCLUDE statement is the number of the line in error in the $INCLUDE file.

Below is an example where the interpreter draws a box around the wrong line (in the main source file) if any error occurs in a compiled programs's $INCLUDE file. When you compile the following, the interpreter marks line 3 in the main program with a box and gives a &quot;Syntax Error&quot; message: REM This is the MAIN program. REM $INCLUDE &quot;JUNK&quot; PRINT &quot;LINE 3&quot;  ' The interpreter flags this line with &quot;Syntax Error&quot; PRINT &quot;LINE 4&quot;

REM This is a separate $INCLUDE file called JUNK, saved in Text format. INPUT PRINT ' This line is a deliberate Syntax Error. Note: REM $INCLUDE statements are ignored when the program is run in the interpreter.

Additional query words: MQuickB

Keywords: KB33142

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.