&lt;center>'''QB64 Compiler Errors''': To troubleshoot compiler errors try this: [[QB64_FAQ#Q:_How_can_I_find_what_caused_a_Compiler_error.3F|recompile scripts]]&lt;/center>

&lt;center>'''Please report any Operating System or Compiler errors or failures you cannot fix  [http://www.qb64.net/forum/index.php?board=3.0 HERE!]'''&lt;/center>


&lt;center>'''It's a good idea to exclude "QB64.exe" from any real-time anti-virus scanning to prevent IDE Module Errors!'''&lt;/center>


The following table describes the error codes that are reported by the '''QB64''' compiler, as well as possible causes and solutions:

{| border="1" cellpadding="2"
|-
! colspan="6"|QB/64 Error Codes
|-
! Code || Description || Common cause/Resolution || QB64 Differences
|-
|  1 || [[NEXT]] without [[FOR]] || Missing loop end or look for a missing [[END IF]] or [[END SELECT]] statement. || none
|-
|  2 || Syntax error || Mistyped keyword statements or puctuation errors can create syntax errors. || none
|-
|  3 || [[RETURN]] without [[GOSUB]] || Place sub-procedure line label after program [[END]] or [[EXIT]] in a [[SUB]]-procedure.|| none
|-
|  4 || Out of DATA || A [[READ]] has read past the end of [[DATA]]. Use [[RESTORE]] to reset to data start. . || none
|-
|  5 || Illegal function call || A parameter passed does not match the function type or exceeds certain function limitations. See [[Illegal Function]]. || none
|-
|  6 || Overflow || A numerical value has exceeded the limitations of a [[Variable Types|variable type]]. || none
|-
|  7 || Out of memory || A module has exceeded the 64K memory limitation of QB. Try breaking the code up to smaller modules.|| no limit
|-
|  8 || Label not defined || [[GOTO]] or [[GOSUB]] tries to branch to a label that doesn't exist. || none
|-
|  9 || Subscript out of range || An [[Arrays|array's]] [[UBOUND|upper]] or [[LBOUND|lower]] [[DIM|dimensioned]] boundary has been exceeded. || none
|-
| 10 || Duplicate definition || You can't define a variable twice with [[DIM]], the first time a variable is used it is also defined. || none
|-
| 11 || Division by zero || You cannot divide any value by zero! Even using [[MOD]]. || none
|-
| 12 || Illegal in direct mode || A statement (like [[DIM]]) in the Immediate window wasn't allowed. ||  N/A
|-
| 13 || Type mismatch || A [[SUB]] or [[FUNCTION]] parameter does not match the procedure Declaration. || none
|-
| 14 || Out of [[STRING|string]] space || A module has exceeded the 32767 text character limit. Use SUB print procedures. || no limit.
|-
| 16 || String formula too complex. || A string formula was too long or [[INPUT]] statement requested more than 15 strings || N/A
|-
| 17 || Cannot continue. || The program while debugging has changed in a way that it cannot continue. || no debug
|-
| 18 || Function not defined. || The function used by the program must be defined. Did you include the .bi file while using a library? || none
|-
| 19 || No [[RESUME]]. || Use [[RESUME]] at the end of the [[ON ERROR]] [[GOTO]] routine, not [[RETURN]]. || none
|-
| 20 || RESUME without error. || [[RESUME]] can only be used in an error handler called by [[ON ERROR]] [[GOTO]]. || none
|-
| 24 || Device timeout. || Use DS0 (DSzero)in the [[OPEN COM]] statement to avoid modem timeouts. || none
|-
| 25 || Device fault. || Device not connected or does not exist. || none
|-
| 26 || [[FOR]] without [[NEXT]]. || Missing loop end or look for a missing [[END IF]] or [[END SELECT]] statement. || none
|-
| 27 || Out of paper || A printer paper error when using [[LPRINT]]. || none
|-
| 29 || [[WHILE]] without [[WEND]]. || [[WEND]] must end a [[WHILE]] loop. Otherwise look for missing [[END IF]] or [[END SELECT]] || none
|-
| 30 || [[WEND]] without [[WHILE]] || Missing loop end or look for a missing [[END IF]] or [[END SELECT]] statement. || none
|-
| 33 || Duplicate label || Line numbers or labels cannot be used twice in a procedure. || none
|-
| 35 || Subprogram not defined. || Often occurs when the Quickbasic Library is not used with [[CALL ABSOLUTE]] or [[INTERRUPT]] or a [[SUB]] or [[FUNCTION]] procedure has not been created for a [[CALL]]. || none
|-
| 37 || Argument-count mismatch || The number of sub-procedure [[parameters]] do not match the call. || none
|-
| 38 || Array not defined || [[Arrays]] using more than 10 elements must be [[DIM|DIMensioned]]. || none
|-
| 40 || Variable required. || [[LEN]] cannot read literal numerical values. A [[GET]] or [[PUT]] statement must specify a variable when reading or writing a file opened in [[BINARY]] mode. || none
|-
| 50 || [[FIELD]] overflow. || A [[FIELD]] statement tried to allocate more bytes than were specified for the record length of a random access file. || none
|-
| 51 || Internal error. || An internal malfunction occured in QuickBASIC or QB64. || none
|-
| 52 || Bad file name or number. || The filename must follow the rules for filenames in the OS and use filenumbers from 1 and 255. Use [[FREEFILE]] to avoid duplicate [[OPEN]] file numbers. || none
|-
| 53 || File not found. || File not in current directory or path. Use [[_FILEEXISTS]] to verify file names. || none
|-
| 54 || Bad file mode. || File access mode does not match a current [[OPEN]] file procedure. || none
|-
| 55 || File already open. || [[CLOSE]] a file to open it in a different mode. || none
|-
| 56 || FIELD statement active. || '''WRITEME''' || N/A
|-
| 57 || Device I/O error. || '''WRITEME''' || N/A
|-
| 58 || File already exists. || The filename specified in the [[NAME]] statement was identical to a file that already exists. || none
|-
| 59 || Bad record length. || Record length exceeds 32767 bytes or is 0 || none
|-
| 61 || Disk full. || The amount of data to write to the disk was more than the free space available, remove some files you don't need and try again. || none
|-
| 62 || Input past end of file. || Check for the end of file with [[EOF]] when reading from a file. || none
|-
| 63 || Bad record number. || [[GET]] read exceeds number of records in a [[RANDOM]] file. || none
|-
| 64 || Bad file name || File name contains illegal characters or exceeds 12 characters. || none
|-
| 67 || Too many files || Over 15 files are open in Qbasic. || none
|-
| 68 || Device unavailable. || Device does not exist, busy or not connected. || none
|-
| 69 || Communication-buffer overflow. || '''WRITEME''' || N/A
|-
| 70 || Permission denied || A file or port is in use on a network, blocked, read only or locked. || none
|-
| 71 || Disk not ready. || Disk is busy or has no media. || none
|-
| 72 || Disk-media error. || Improper media format or bad data. || none
|-
| 73 || Feature unavailable. || Based on the DOS version available. || none
|-
| 74 || Rename across disks. || '''WRITEME''' || N/A
|-
| 75 || Path/File access error. || File or path cannot be accessed. || none
|-
| 76 || Path not found. || Path is not access-able or does not exist. Use [[_DIREXISTS]] to check paths.|| none
|-
| 97 || (no error message) || Can be used to trigger an error trap event with [[ERROR]] 97, nothing else will cause this error, so create your own errors for [[ON ERROR]]. || none
|-
|}
&lt;center>'''N/A means Not Available or Not Applicable to QB64.'''&lt;/center>


{| border="1" cellpadding="2"
! colspan="6"|QB64 Error Codes
|-
! Code || Description || Common cause/resolution || QB Differences
|-
| 258 || Invalid handle || Zero or bad handle values cannot be used by the QB64 procedure creating the error. || N/A
|}



==Other Errors==

* '''Syntax errors''': '''QB64''' will display most statement syntax and parameter errors in the Status area below the editing area in the [[IDE]]. It may also show missing brackets or other syntax punctuation required. Check the keyword's [[Syntax Notation Conventions|syntax]] when necessary!


* '''CPU Memory errors''' can be created when QB64 loads too many images at one time using [[_LOADIMAGE]] or [[_NEWIMAGE]] without freeing them. Use [[_FREEIMAGE]] to free unused handles. Also may be caused by continually running loops.


* '''Parameter Type Mismatch''': Qbasic's IDE may add DEF statements before any [[SUB]] or [[FUNCTION]]. '''QB64'''(like QB) will change all variable types in subsequent sub-procedures to that default variable type without giving a [[ERROR Codes|"Parameter Type Mismatch"]] warning or adding the proper DEF statement to subsequent procedures! If you do not want that to occur, either remove that DEF statement or add the proper DEF type statements to subsequent procedures. May also affect [[$INCLUDE]] procedures!

==See also==
* [[ERROR]] (simulates error), [[ERR]] ('''QB''' error code number), [[ERL]] (closest line number when line numbers are used)
* [[ON ERROR]] (calls error handing routine using [[GOTO]] only), [[_ERRORLINE]] (actual '''QB64''' text code line)


{{PageNavigation}}
