Microsoft KB Archive/43020

= (Complete) Compile-Time Error Chart for Macintosh QuickBasic =

Article ID: 43020

Article Last Modified on 11/21/2006



This article was previously published under Q43020



SUMMARY
The &quot;Compile-Time Error Messages&quot; chart was left out of the &quot;Microsoft QuickBasic For Apple Macintosh: Language Reference&quot; manual for versions 1.00, 1.00a, and 1.00b. To supplement the manual, you may use the error message chart included below, which is taken from the earlier compiler (pages 437-448 of the &quot;Microsoft Basic Compiler for Apple Macintosh&quot; manual for Microsoft Basic Compiler version 1.00 for Apple Macintosh).



MORE INFORMATION
The following compile-time error messages are described in greater detail further below:   Error #     Compile-Time Error Message ---    --

1         SUB without END SUB 2         Wrong Number of arguments 3         Undefined DATA label 4         Expecting a variable 5         Expecting end of statement 6         Illegal character 7         END SUB/EXIT SUB in main program 8         DEF statement syntax error 9         Invalid statement label 10         Duplicate statement label 11         Duplicate subprogram name 12         Duplicate variable name 13         Missing main program 14         Missing argument 15         Numeric overflow 16         Illegal statement ordering 17         Syntax error 18         Undefined statement label 19         Undeclared array 21         Expecting closing parenthesis 23         I/O control list error 24         Maximum of seven dimensions exceeded 25         Array subscript error 27         Spelling error? 28         Unterminated FOR or WHILE loop 29         IF without END IF   30          ELSE/ELSEIF without IF   31          Static array redimensioned 32         $INCLUDE file not found 33         Alpha character expected 34         Illegal $INCLUDE statement in $INCLUDE file 36         SELECT CASE without END SELECT 37         CASE statement expected 39         DATA statement in single-line IF statement 40         I/O control argument is not CHARACTER 41         Expecting a symbol 42         Expecting an opening parenthesis 43         Unexpected end of statement 44         Invalid $OPTION specifier 45         NEXT without FOR or WEND without WHILE 46         END IF without IF   47          Array boundary error 48         Illegal FOR variable 49         Case constant exceeds 126-character limit 50         Semicolon was expected 51         A comma was expected 52         Argument type mismatch 53         This feature requires the N option 54         FOR/WHILE loops nested deeper than 64 55         CASE without SELECT CASE 56         Statement not in a subprogram block 58         Attempt to redefine option base 59         Illegal argument 60         Address out of 16-bit-range - use A option 61         An equals sign was expected 62         Undeclared subprogram 63         Static variables cannot be erased 64         System startup code file not found 65         Internal error 99         Internal stack level error Undefined error code - internal error Below is a description of each compile-time error message:   Error #     Compile-Time Error Message ---    --

1         SUB without END SUB

This occurs when the compiler encounters two SUB state- ments without an intervening END SUB statement, or a              SUB statement without a matching END SUB statement.

2         Wrong number of arguments

An intrinsic or user-defined function or subprogram was called with the wrong number of arguments. For example, the number of arguments in a subprogram CALL statement was not the same as the number of parameters in the corresponding SUB statement.

3         Undefined DATA label

A label referenced by a RESTORE statement does not exist in the program.

4         Expecting a variable

An intrinsic function expects a variable in this position, but was passed an expression instead. An              example of this is VARPTR, which takes a single parameter that must be a variable.

5         Expecting end of statement

The statement has been completely processed by the compiler and there is text remaining on the line that is not a trailing comment or legal statement separator. This can be caused by characters unrecognizable to              Basic on the line, an incorrect trailing comment format, or parameters beyond those defined for the statement.

6         Illegal character

The compiler did not find an expected character, as in              the following examples:

1. A parameter in a function definition statement (DEF FN) is not followed by a comma or a right parenthesis.

2. The compiler expected an expression or subexpres- sion, but the next character was not one of the characters that can legally begin an expression, namely, an alphanumeric character, left or right parenthesis, +, or -.

7         END SUB/EXIT SUB in main program

This indicates an END SUB or EXIT SUB statement that has no matching SUB statement.

8         DEF statement syntax error

This error is caused by one of the following two conditions:

1. The name following the DEF keyword in a user- defined function does not start with the letters FN.

2. The range of characters in a DEFINT, DEFSNG, DEFDBL, or DEFSTR statement is out of alphabetical order.

9         Invalid statement label

A line number has a value greater the 65,529.

10         Duplicate statement label

The same line number or label exists in a previous line in the program or subprogram.

11         Duplicate subprogram name

A subprogram name appears in two SUB statements in the same program.

12         Duplicate Variable name

The same variable appears in more than one COMMON statement.

13         Missing main program

The program contains no executable statements outside of a subprogram definition.

14         Missing argument

An intrinsic function was called without enough arguments.

15         Numeric overflow

This occurs when an expression resolved at compile time exceeds the maximum number that can be represented.

16         Illegal statement ordering

This can be caused by several conditions, four of which are as follows:

1. A SHARED statement either follows executable code in                 a subprogram or appears outside a subprogram block.

2. An ERASE statement for shared or passed arrays occurs in a subprogram.

3. A user-defined function is called before the function definition is given in a DEF FN statement.

4. A COMMON statement appears in a subprogram.

17         Syntax error

This can be caused by a number of different conditions, some of which are listed below:

1. An expression contains an operator without a                 following operand.

2. An expression contains two operands without a                 connecting operator.

3. A THEN keyword is missing an IF...THEN...ELSE statement.

4. A TO keyword is missing in a FOR...NEXT loop.

5. SELECT appears without the CASE keyword.

6. IF condition or ELSEIF condition is not followed by                  the keyword THEN.

7. An ON ERROR clause is not followed by GOTO, or an ON                 event clause is not followed by GOSUB.

8. The hyphen (-) is missing between coordinate pairs in a statement such as BUTTON or LINE.

18         Undefined statement label

A label referred to in an IF...THEN ...ELSE, GOSUB, or GOTO statement does not exist in the program or              subprogram.

19         Undeclared array

This error can result from one of the following conditions:

1. A GET, PUT, or WAVE statement contains a reference to an array that has not been previously declared in                 a DIM statement.

2. An array referenced in a SHARED statement was not found in the main program.

21         Expecting closing parenthesis

The end of an expression was reached without enough right parentheses to balance the left parentheses encountered.

23         I/O control list error

This error can be caused by one of the following conditions:

1. No legal mode is specified after FOR in an OPEN statement.

2. The keyword AS is missing in an OPEN or NAME statement.

3. The LEN keyword was not used when an attempt was made to specify a file buffer size in an OPEN statement.

4. A constant null string (&quot;&quot;) is used for a filename in an OPEN statement.

5. There is an error in the format of a PRINT [#] USING format string or an INPUT statement prompt string.

24         Maximum of seven dimensions exceeded

The Basic compiler limits arrays to a maximum of seven dimensions.

25         Array subscript error

A static array reference has the wrong number of              indexes.

27         Spelling error?

A statement does not begin with a number, label, keyword, or comment character.

28         Unterminated FOR or WHILE loop

The compiler has reached the end of the program with an              unbalanced FOR statement; that is, one without a               corresponding NEXT. This error message also appears when the program has a WHILE statement without a              matching WEND statement.

29         IF without END IF

The compiler has reached the end of the program with an              unbalanced block IF statement; that is, one without a               matching END IF statement.

30         ELSE/ELSEIF without IF

There was no block IF statement pending when this block ELSE statement was encountered.

31         Static array redimensioned

Limits for a static array were declared more than once.

32         $INCLUDE file not found

A file specified in a $INCLUDE statement does not exist or cannot be found by the compiler in the specified volume or folder.

33         Alpha character expected

An identifier that starts with a letter is expected at              this point.

34         Illegal $INCLUDE statement in $INCLUDE file

The compiler has encountered an $INCLUDE statement while processing another $INCLUDE statement. $INCLUDE statements cannot be nested.

36         SELECT CASE without END SELECT

The compiler has reached the end of the program with an              unbalanced CASE statement, that is, one without a               corresponding END SELECT.

37         CASE statement expected

The statement immediately following a SELECT CASE statement is not a CASE statement. All statements between a SELECT CASE statement and the matching END SELECT statement must be introduced by a CASE statement.

39         DATA statement in single-line IF statement

A DATA statement cannot be part of a single-line IF...THEN...ELSE statement. DATA statements can appear in block IF...THEN...ELSE statements, but they are not conditional.

40         I/O control argument is not CHARACTER

This is caused by one of the following two conditions:

1. AS in a FIELD statement is not defined by a string variable.

2. A non-string expression is used for the mode or the filename in an OPEN statement.

41         Expecting a symbol

The compiler encountered something such as a constant, keyword, or operator, instead of an expected symbol.

42         Expecting an opening parenthesis

This can be caused by one of the following two conditions:

1. The compiler did not find a required left parenthesis before the argument list in a call to a                 subprogram, an intrinsic Basic function, or a                  user-defined function.

2. The compiler did not find a required left parenthesis before a coordinate pair in a statement such as BUTTON, EDIT FIELD, or WINDOW.

43         Unexpected end of statement

The compiler reached a statement separator without completely processing the statement; it expects more text.

44         Invalid $OPTION specifier

An attempt was made to change some option other than A              (use long addressing mode) or C (check array               boundaries) in an $OPTION metacommand.

45         NEXT without FOR or WEND without WHILE

A NEXT statement was encountered when no FOR was pending, or a WEND statement was encountered when no              WHILE was pending.

46         END IF without IF

An END IF statement was encountered when no block IF              statement was pending.

47         Array boundary error

This error can result from one of the following conditions:

1. A static array reference is outside the limits of                 the array. This is the only boundary checking that can be done in the compiler; all other types are done at run time.

2. A static array is declared in such a way that it                 cannot have any elements, as in the following example:

OPTION BASE 1 DIM STATIC ARRAY%(0)

48         Illegal FOR variable

An array reference is used as a FOR variable.

49         Case constant exceeds 126 character limit

The maximum length permissible for a string in a CASE selector statement is 126 characters.

50         Semicolon was expected

The compiler did not find a semicolon after string-expression in a PRINT USING string-expression or              PRINT #filenumber USING string-expression statement.

51         A comma was expected

The compiler encountered a syntax error in any of              several I/O statements, subprograms and function calls, or declarations.

52         Argument type mismatch

This error is encountered in a number of instances where types should match. For example, in subprogram calls, this message indicates that the actual argument types do not exactly match the declared parameter types in the SUB statement. In function calls, it indicates a              character has been passed for a number of vice-versa.

This error also occurs in the following situations:

1. A LINE INPUT statement is followed by some- thing other that a string variable.

2. There is a string array in a graphics GET or                  PUT statement.

3. Something other that a string expression is                  used in a BUTTON, EDIT FIELD, PICTURE, or                   WINDOW statement.

53         This feature requires the N option

This features requires some process to occur between each statement; this processing is enabled by the compiler N option. Note that this option significantly slows program execution.

54         FOR/WHILE loops nested deeper than 64

The combined number of FOR and WHILE statements without matching NEXT or WEND statements is greater that 64.

55         CASE without SELECT CASE

The compiler has encountered a CASE statement outside a SELECT CASE...END SELECT block.

56         Statement not in a subprogram block

After the main program block, the compiler encountered statements following an END SUB statement that are not in a new SUB...END SUB subprogram block.

Subprogram blocks cannot be interspersed with the main program; subprograms must appear either before or after the main program block.

58         Attempt to redefine option base

The option base is a global value in a compiled Basic program and can be defined only once. This value can be defined explicitly in an OPTION BASE statement or              implicitly by simply declaring an array. In the latter case, the option base is 0, the default.

59         Illegal argument

An invalid argument was passed to an intrinsic Basic function, such as a static array as the argument to              LBOUND or UBOUND.

60         Address out of 16-bit-range - use A option

Your program is too large for the default addressing mode. Recompile your program with the A option (long addressing mode). (See Section 4.3.1 for              information about the A option.)

61         An equals sign was expected

The compiler did not encounter an expected equal (=) sign. This error can be caused by any situation where an equal sign should appear (such as after the LEN              keyword in an OPEN statement), but does not.

62         Undeclared subprogram

A name does not refer to a legal subprogram. This error occurs when both of the following conditions are true:

1. A user-defined name in a CALL statement is                   not defined in a SUB statement and is not a defined variable.

2. There are no LIBRARY statements in the program.

63         Static variables cannot be erased

The argument in an ERASE statement is a static array.

64         System startup code file not found

The compiler was unable to find the basinit file (basinit contains the run-time start-up object code              and other resources required by the compiler).

65         Internal error

The compiler has detected an unexpected error. This error report indicates a problem within the compiler rather than within the source code being compiled. Please report the conditions and the circumstances in              which it occurred to Microsoft, using the Software Problem Report at the back of this manual.

99         Internal stack level error

This occurs when the compiler detects that the code it has generated would leave the run-time stack in              an inconsistent state. As in error 65, this indicates a problem in the compiler that should be reported to              Microsoft.

Undefined error code - internal error

This error occurs when the compiler error handler encounters an undefined error number. As in errors 65 and 99, this indicates a problem in the compiler that should be reported to Microsoft.

Additional query words: MQuickB

Keywords: KB43020

-

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

© Microsoft Corporation. All rights reserved.