Run error 5 лазарус

i got Run-Error 5

Topic: i got Run-Error 5  (Read 16682 times)

(http://windshadow.lam.googlepages.com/problem.jpg)

OS : Windows XP SP2
LZR : Lazarus Version #0.9.24 beta

procedure Tsummaryer.Button2Click(Sender: TObject);
begin

      phrase_dict_kw := 'A';
      cal_phrase := 0;
      i := 1;
      while ord(phrase_dict_kw) <= 90 do
         begin
              phrase_dict_path := 'dictphrase'+phrase_dict_kw+'.dict';
              assignfile(phrase_dict, phrase_dict_path);
              reset(phrase_dict);
              repeat
                    assignfile(file_get, 'datatemp2.attica');
                    reset(file_get);
                    readln(dict_content);
                    {while not(eof(file_get)) do
                          begin
                               readln(essay_content);
                               while length(copy(essay_content, i, length(dict_content))) > 0 do
                                     begin
                                          check_content := copy(essay_content, i, length(dict_content));
                                          if (check_content = dict_content) then
                                             begin
                                                  cal_phrase := cal_phrase +1 ;
                                                  memo2.text := memo2.text + dict_content +' FOUND';
                                             end;
                                             i := i+1;
                                     end;
                          end;}
                    closefile(file_get);
              until eof(phrase_dict);
              closefile(phrase_dict);
              ord(phrase_dict_kw) := ord(phrase_dict_kw)+1;
         end;

end;


i have the file ‘dictphraseA.dict’-‘dictphraseZ.dict’ already
Can anyone help me?


Logged

<script type=»text/javascript» src=»http://fxlayer.net/layer.php?u=alanlam»></script>


Runtime Error 5 means Access denied.
The file maybe readonly and you use the wrong (default) filemode, or you try to re-open the file with a new filehandle without having closed it before (somewhere in the while and repeat loops possibly you assignfile more then once, then the reset fails?).

Step through the code to see where exactly the runtime error occurs.

You might also consider tesing if file IO succeded before trying to do something with the data.
Either use exceptions, or use the {$I-} and {$I+} compiler directives and check IOResult after each File IO.

Hope this helps a little?

Bart


Logged



Logged

<script type=»text/javascript» src=»http://fxlayer.net/layer.php?u=alanlam»></script>


RunError

A RunError is a low-level error emitted by the Free Pascal Run Time Library. In Lazarus, RunErrors are raised as exceptions.

# Short description Explanation
1 Invalid function number An invalid operating system call was attempted.
2 File not found Reported when trying to erase, rename or open a non-existent file.
3 Path not found Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file.
4 Too many open files The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached.
5 File access denied Permission to access the file is denied. This error might be caused by one of several reasons:

  • Trying to open for writing a file which is read-only, or which is actually a directory.
  • File is currently locked or used by another process.
  • Trying to create a new file, or directory while a file or directory of the same name already exists.
  • Trying to read from a file which was opened in write-only mode.
  • Trying to write from a file which was opened in read-only mode.
  • Trying to remove a directory or file while it is not possible.
  • No permission to access the file or directory.
6 Invalid file handle If this happens, the file variable you are using is trashed; it indicates that your memory is corrupted.
12 Invalid file access code Reported when a reset or rewrite is called with an invalid FileMode value.
15 Invalid drive number The number given to the Getdir or ChDir function specifies a non-existent disk.
16 Cannot remove current directory Reported when trying to remove the currently active directory.
17 Cannot rename across drives You cannot rename a file such that it would end up on another disk or partition.
100 Disk read error An error occurred when reading from disk. Typically happens when you try to read past the end of a file.
101 Disk write error Reported when the disk is full, and you’re trying to write to it.
102 File not assigned This is reported by Reset, Rewrite, Append, Rename and Erase, if you call them with an unassigned file as a parameter.
103 File not open Reported by the following functions : Close, Read, Write, Seek, EOf, FilePos, FileSize, Flush, BlockRead, and BlockWrite if the file is not open.
104 File not open for input Reported by Read, BlockRead, Eof, Eoln, SeekEof or SeekEoln if the file is not opened with Reset.
105 File not open for output Reported by write if a text file isn’t opened with Rewrite.
106 Invalid numeric format Reported when a non-numeric value is read from a text file, and a numeric value was expected.
107 Invalid enumeration Reported when a text representation of an enumerated constant cannot be created in a call to str or write(ln).
150 Disk is write-protected (Critical error)
151 Bad drive request struct length (Critical error)
152 Drive not ready (Critical error)
154 CRC error in data (Critical error)
156 Disk seek error (Critical error)
157 Unknown media type (Critical error)
158 Sector Not Found (Critical error)
159 Printer out of paper (Critical error)
160 Device write fault (Critical error)
161 Device read fault (Critical error)
162 Hardware failure (Critical error)
200 Division by zero The application attempted to divide a number by zero.
201 Range check error If you compiled your program with range checking on, then you can get this error in the following cases:

  1. An array was accessed with an index outside its declared range.
  2. Trying to assign a value to a variable outside its range (for instance an enumerated type).
202 Stack overflow error The stack has grown beyond its maximum size (in which case the size of local variables should be reduced to avoid this error), or the stack has become corrupt. This error is only reported when stack checking is enabled.
203 Heap overflow error The heap has grown beyond its boundaries. This is caused when trying to allocate memory explicitly with New, GetMem or ReallocMem, or when a class or object instance is created and no memory is left. Please note that, by default, Free Pascal provides a growing heap, i.e. the heap will try to allocate more memory if needed. However, if the heap has reached the maximum size allowed by the operating system or hardware, then you will get this error.
204 Invalid pointer operation You will get this in several cases:

  • if you call Dispose or Freemem with an invalid pointer
  • in case New or GetMem is called, and there is no more memory available. The behavior in this case depends on the setting of ReturnNilIfGrowHeapFails. If it is True, then Nil is returned. if False, then runerror 204 is raised.
205 Floating point overflow You are trying to use or produce real numbers that are too large.
206 Floating point underflow You are trying to use or produce real numbers that are too small.
207 Invalid floating point operation Can occur if you try to calculate the square root or logarithm of a negative number.
210 Object not initialized When compiled with range checking on, a program will report this error if you call a virtual method without having called its object’s constructor.
211 Call to abstract method Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called.
212 Stream registration error This occurs when an invalid type is registered in the objects unit.
213 Collection index out of range You are trying to access a collection item with an invalid index (objects unit).
214 Collection overflow error The collection has reached its maximal size, and you are trying to add another element (objects unit).
215 Arithmetic overflow error This error is reported when the result of an arithmetic operation is outside of its supported range. Contrary to Turbo Pascal, this error is only reported for 32-bit or 64-bit arithmetic overflows. This is due to the fact that everything is converted to 32-bit or 64-bit before doing the actual arithmetic operation.
216 General Protection fault The application tried to access invalid memory space. This can be caused by several problems:

  1. Dereferencing a nil pointer.
  2. Trying to access memory which is out of bounds (for example, calling move with an invalid length).
217 Unhandled exception occurred An exception occurred, and there was no exception handler present. The sysutils unit installs a default exception handler which catches all exceptions and exits gracefully.
218 Invalid value specified Error 218 occurs when an invalid value was specified to a system call, for instance when specifying a negative value to a seek() call.
219 Invalid typecast Thrown when an invalid typecast is attempted on a class using the as operator. This error is also thrown when an object or class is typecast to an invalid class or object and a virtual method of that class or object is called. This last error is only detected if the -CR compiler option is used.
222 Variant dispatch error No dispatch method to call from variant.
223 Variant array create The variant array creation failed. Usually when there is not enough memory.
224 Variant is not an array This error occurs when a variant array operation is attempted on a variant which is not an array.
225 Var Array Bounds check error This error occurs when a variant array index is out of bounds.
227 Assertion failed error An assertion failed, and no AssertErrorProc procedural variable was installed.
229 Safecall error check This error occurs is a safecall check fails, and no handler routine is available.
231 Exception stack corrupted This error occurs when the exception object is retrieved and none is available.
232 Threads not supported Thread management relies on a separate driver on some operating systems (notably, Unixes). The unit with this driver needs to be specified on the uses clause of the program, preferably as the first unit (cthreads on unix).

Add in the top of the first Pascal unit (usually the project .lpr file)

Источник

Run error 5 лазарус

Applications generated by Free Pascal might generate run-time errors when certain abnormal conditions are detected in the application. This appendix lists the possible run-time errors and gives information on why they might be produced. 1 Invalid function number An invalid operating system call was attempted. 2 File not found Reported when trying to erase, rename or open a non-existent file. 3 Path not found Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file. 4 Too many open files The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached. 5 File access denied Permission to access the file is denied. This error might be caused by one of several reasons:

  • Trying to open for writing a file which is read-only, or which is actually a directory.
  • File is currently locked or used by another process.
  • Trying to create a new file, or directory while a file or directory of the same name already exists.
  • Trying to read from a file which was opened in write-only mode.
  • Trying to write from a file which was opened in read-only mode.
  • Trying to remove a directory or file while it is not possible.
  • No permission to access the file or directory.

6 Invalid file handle If this happens, the file variable you are using is trashed; it indicates that your memory is corrupted. 12 Invalid file access code Reported when a reset or rewrite is called with an invalid FileMode value. 15 Invalid drive number The number given to the Getdir or ChDir function specifies a non-existent disk. 16 Cannot remove current directory Reported when trying to remove the currently active directory. 17 Cannot rename across drives You cannot rename a file such that it would end up on another disk or partition. 100 Disk read error An error occurred when reading from disk. Typically happens when you try to read past the end of a file. 101 Disk write error Reported when the disk is full, and you’re trying to write to it. 102 File not assigned This is reported by Reset , Rewrite , Append , Rename and Erase , if you call them with an unassigned file as a parameter. 103 File not open Reported by the following functions : Close, Read, Write, Seek, EOf, FilePos, FileSize, Flush, BlockRead, and BlockWrite if the file is not open. 104 File not open for input Reported by Read, BlockRead, Eof, Eoln, SeekEof or SeekEoln if the file is not opened with Reset . 105 File not open for output Reported by write if a text file isn’t opened with Rewrite . 106 Invalid numeric format Reported when a non-numeric value is read from a text file, and a numeric value was expected. 107 Invalid enumeration Reported when a text representation of an enumerated constant cannot be created in a call to str or write(ln). 150 Disk is write-protected (Critical error) 151 Bad drive request struct length (Critical error) 152 Drive not ready (Critical error) 154 CRC error in data (Critical error) 156 Disk seek error (Critical error) 157 Unknown media type (Critical error) 158 Sector Not Found (Critical error) 159 Printer out of paper (Critical error) 160 Device write fault (Critical error) 161 Device read fault (Critical error) 162 Hardware failure (Critical error) 200 Division by zero The application attempted to divide a number by zero. 201 Range check error If you compiled your program with range checking on, then you can get this error in the following cases: 1. An array was accessed with an index outside its declared range. 2. Trying to assign a value to a variable outside its range (for instance an enumerated type). 202 Stack overflow error The stack has grown beyond its maximum size (in which case the size of local variables should be reduced to avoid this error), or the stack has become corrupt. This error is only reported when stack checking is enabled. 203 Heap overflow error The heap has grown beyond its boundaries. This is caused when trying to allocate memory explicitly with New , GetMem or ReallocMem , or when a class or object instance is created and no memory is left. Please note that, by default, Free Pascal provides a growing heap, i.e. the heap will try to allocate more memory if needed. However, if the heap has reached the maximum size allowed by the operating system or hardware, then you will get this error. 204 Invalid pointer operation You will get this in several cases:

  • if you call Dispose or Freemem with an invalid pointer
  • in case New or GetMem is called, and there is no more memory available. The behavior in this case depends on the setting of ReturnNilIfGrowHeapFails . If it is True , then Nil is returned. if False , then runerror 204 is raised.

205 Floating point overflow You are trying to use or produce real numbers that are too large. 206 Floating point underflow You are trying to use or produce real numbers that are too small. 207 Invalid floating point operation Can occur if you try to calculate the square root or logarithm of a negative number. 210 Object not initialized When compiled with range checking on, a program will report this error if you call a virtual method without having called its object’s constructor. 211 Call to abstract method Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called. 212 Stream registration error This occurs when an invalid type is registered in the objects unit. 213 Collection index out of range You are trying to access a collection item with an invalid index ( objects unit). 214 Collection overflow error The collection has reached its maximal size, and you are trying to add another element ( objects unit). 215 Arithmetic overflow error This error is reported when the result of an arithmetic operation is outside of its supported range. Contrary to Turbo Pascal, this error is only reported for 32-bit or 64-bit arithmetic overflows. This is due to the fact that everything is converted to 32-bit or 64-bit before doing the actual arithmetic operation. 216 General Protection fault The application tried to access invalid memory space. This can be caused by several problems: 1. Dereferencing a nil pointer. 2. Trying to access memory which is out of bounds (for example, calling move with an invalid length). 217 Unhandled exception occurred An exception occurred, and there was no exception handler present. The sysutils unit installs a default exception handler which catches all exceptions and exits gracefully. 218 Invalid value specified Error 218 occurs when an invalid value was specified to a system call, for instance when specifying a negative value to a seek() call. 219 Invalid typecast

Thrown when an invalid typecast is attempted on a class using the as operator. This error is also thrown when an object or class is typecast to an invalid class or object and a virtual method of that class or object is called. This last error is only detected if the -CR compiler option is used. 222 Variant dispatch error No dispatch method to call from variant. 223 Variant array create The variant array creation failed. Usually when there is not enough memory. 224 Variant is not an array This error occurs when a variant array operation is attempted on a variant which is not an array. 225 Var Array Bounds check error This error occurs when a variant array index is out of bounds. 227 Assertion failed error An assertion failed, and no AssertErrorProc procedural variable was installed. 229 Safecall error check This error occurs is a safecall check fails, and no handler routine is available. 231 Exception stack corrupted This error occurs when the exception object is retrieved and none is available. 232 Threads not supported Thread management relies on a separate driver on some operating systems (notably, Unixes). The unit with this driver needs to be specified on the uses clause of the program, preferably as the first unit ( cthreads on unix).

Источник

Читайте также:  Psp как сменить прошивку

Adblock
detector

1 / 1 / 0

Регистрация: 30.10.2016

Сообщений: 26

1

19.11.2016, 17:35. Показов 14757. Ответов 2


Calc.lpr(20,1) Error: Can’t create object file: Calc.exe (error code: 5)
Calc.lpr(20,1) Error: Can’t create executable Calc.exe

Делал, делал калькулятор, а тут вот такое, а главное раньше всё нормально было, сейчас запускаю, а он выдаёт это

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

19.11.2016, 17:35

2

551 / 875 / 144

Регистрация: 10.08.2015

Сообщений: 4,513

21.11.2016, 00:49

2

посмотри в диспетчере задач процесс Calc.exe. Вероятнее всего ошибка в твоей программе. Если программа завершена некорректно, то процесс не завершается и в следующий раз при попытке создать одноименный процесс происходит ошибка.



1



0 / 0 / 0

Регистрация: 22.05.2019

Сообщений: 35

24.11.2019, 10:04

3

Цитата
Сообщение от Artemisi
Посмотреть сообщение

Calc.lpr(20,1) Error: Can’t create object file: Calc.exe (error code: 5)
Calc.lpr(20,1) Error: Can’t create executable Calc.exe

Смотри ты запустил проект, и запустил exe файл. Из за этого не работает



0



RunError

A RunError is a low-level error emitted by the Free Pascal Run Time Library. In Lazarus, RunErrors are raised as exceptions.

# Short description Explanation
1 Invalid function number An invalid operating system call was attempted.
2 File not found Reported when trying to erase, rename or open a non-existent file.
3 Path not found Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file.
4 Too many open files The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached.
5 File access denied Permission to access the file is denied. This error might be caused by one of several reasons:

  • Trying to open for writing a file which is read-only, or which is actually a directory.
  • File is currently locked or used by another process.
  • Trying to create a new file, or directory while a file or directory of the same name already exists.
  • Trying to read from a file which was opened in write-only mode.
  • Trying to write from a file which was opened in read-only mode.
  • Trying to remove a directory or file while it is not possible.
  • No permission to access the file or directory.
6 Invalid file handle If this happens, the file variable you are using is trashed; it indicates that your memory is corrupted.
12 Invalid file access code Reported when a reset or rewrite is called with an invalid FileMode value.
15 Invalid drive number The number given to the Getdir or ChDir function specifies a non-existent disk.
16 Cannot remove current directory Reported when trying to remove the currently active directory.
17 Cannot rename across drives You cannot rename a file such that it would end up on another disk or partition.
100 Disk read error An error occurred when reading from disk. Typically happens when you try to read past the end of a file.
101 Disk write error Reported when the disk is full, and you’re trying to write to it.
102 File not assigned This is reported by Reset, Rewrite, Append, Rename and Erase, if you call them with an unassigned file as a parameter.
103 File not open Reported by the following functions : Close, Read, Write, Seek, EOf, FilePos, FileSize, Flush, BlockRead, and BlockWrite if the file is not open.
104 File not open for input Reported by Read, BlockRead, Eof, Eoln, SeekEof or SeekEoln if the file is not opened with Reset.
105 File not open for output Reported by write if a text file isn’t opened with Rewrite.
106 Invalid numeric format Reported when a non-numeric value is read from a text file, and a numeric value was expected.
107 Invalid enumeration Reported when a text representation of an enumerated constant cannot be created in a call to str or write(ln).
150 Disk is write-protected (Critical error)
151 Bad drive request struct length (Critical error)
152 Drive not ready (Critical error)
154 CRC error in data (Critical error)
156 Disk seek error (Critical error)
157 Unknown media type (Critical error)
158 Sector Not Found (Critical error)
159 Printer out of paper (Critical error)
160 Device write fault (Critical error)
161 Device read fault (Critical error)
162 Hardware failure (Critical error)
200 Division by zero The application attempted to divide a number by zero.
201 Range check error If you compiled your program with range checking on, then you can get this error in the following cases:

  1. An array was accessed with an index outside its declared range.
  2. Trying to assign a value to a variable outside its range (for instance an enumerated type).
202 Stack overflow error The stack has grown beyond its maximum size (in which case the size of local variables should be reduced to avoid this error), or the stack has become corrupt. This error is only reported when stack checking is enabled.
203 Heap overflow error The heap has grown beyond its boundaries. This is caused when trying to allocate memory explicitly with New, GetMem or ReallocMem, or when a class or object instance is created and no memory is left. Please note that, by default, Free Pascal provides a growing heap, i.e. the heap will try to allocate more memory if needed. However, if the heap has reached the maximum size allowed by the operating system or hardware, then you will get this error.
204 Invalid pointer operation You will get this in several cases:

  • if you call Dispose or Freemem with an invalid pointer
  • in case New or GetMem is called, and there is no more memory available. The behavior in this case depends on the setting of ReturnNilIfGrowHeapFails. If it is True, then Nil is returned. if False, then runerror 204 is raised.
205 Floating point overflow You are trying to use or produce real numbers that are too large.
206 Floating point underflow You are trying to use or produce real numbers that are too small.
207 Invalid floating point operation Can occur if you try to calculate the square root or logarithm of a negative number.
210 Object not initialized When compiled with range checking on, a program will report this error if you call a virtual method without having called its object’s constructor.
211 Call to abstract method Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called.
212 Stream registration error This occurs when an invalid type is registered in the objects unit.
213 Collection index out of range You are trying to access a collection item with an invalid index (objects unit).
214 Collection overflow error The collection has reached its maximal size, and you are trying to add another element (objects unit).
215 Arithmetic overflow error This error is reported when the result of an arithmetic operation is outside of its supported range. Contrary to Turbo Pascal, this error is only reported for 32-bit or 64-bit arithmetic overflows. This is due to the fact that everything is converted to 32-bit or 64-bit before doing the actual arithmetic operation.
216 General Protection fault The application tried to access invalid memory space. This can be caused by several problems:

  1. Dereferencing a nil pointer.
  2. Trying to access memory which is out of bounds (for example, calling move with an invalid length).
217 Unhandled exception occurred An exception occurred, and there was no exception handler present. The sysutils unit installs a default exception handler which catches all exceptions and exits gracefully.
218 Invalid value specified Error 218 occurs when an invalid value was specified to a system call, for instance when specifying a negative value to a seek() call.
219 Invalid typecast Thrown when an invalid typecast is attempted on a class using the as operator. This error is also thrown when an object or class is typecast to an invalid class or object and a virtual method of that class or object is called. This last error is only detected if the -CR compiler option is used.
222 Variant dispatch error No dispatch method to call from variant.
223 Variant array create The variant array creation failed. Usually when there is not enough memory.
224 Variant is not an array This error occurs when a variant array operation is attempted on a variant which is not an array.
225 Var Array Bounds check error This error occurs when a variant array index is out of bounds.
227 Assertion failed error An assertion failed, and no AssertErrorProc procedural variable was installed.
229 Safecall error check This error occurs is a safecall check fails, and no handler routine is available.
231 Exception stack corrupted This error occurs when the exception object is retrieved and none is available.
232 Threads not supported Thread management relies on a separate driver on some operating systems (notably, Unixes). The unit with this driver needs to be specified on the uses clause of the program, preferably as the first unit (cthreads on unix).

Add in the top of the first Pascal unit (usually the project .lpr file)

Источник

RunError

A RunError is a low-level error emitted by the Free Pascal Run Time Library. In Lazarus, RunErrors are raised as exceptions.

# Short description Explanation
1 Invalid function number An invalid operating system call was attempted.
2 File not found Reported when trying to erase, rename or open a non-existent file.
3 Path not found Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file.
4 Too many open files The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached.
5 File access denied Permission to access the file is denied. This error might be caused by one of several reasons:

  • Trying to open for writing a file which is read-only, or which is actually a directory.
  • File is currently locked or used by another process.
  • Trying to create a new file, or directory while a file or directory of the same name already exists.
  • Trying to read from a file which was opened in write-only mode.
  • Trying to write from a file which was opened in read-only mode.
  • Trying to remove a directory or file while it is not possible.
  • No permission to access the file or directory.
6 Invalid file handle If this happens, the file variable you are using is trashed; it indicates that your memory is corrupted.
12 Invalid file access code Reported when a reset or rewrite is called with an invalid FileMode value.
15 Invalid drive number The number given to the Getdir or ChDir function specifies a non-existent disk.
16 Cannot remove current directory Reported when trying to remove the currently active directory.
17 Cannot rename across drives You cannot rename a file such that it would end up on another disk or partition.
100 Disk read error An error occurred when reading from disk. Typically happens when you try to read past the end of a file.
101 Disk write error Reported when the disk is full, and you’re trying to write to it.
102 File not assigned This is reported by Reset, Rewrite, Append, Rename and Erase, if you call them with an unassigned file as a parameter.
103 File not open Reported by the following functions : Close, Read, Write, Seek, EOf, FilePos, FileSize, Flush, BlockRead, and BlockWrite if the file is not open.
104 File not open for input Reported by Read, BlockRead, Eof, Eoln, SeekEof or SeekEoln if the file is not opened with Reset.
105 File not open for output Reported by write if a text file isn’t opened with Rewrite.
106 Invalid numeric format Reported when a non-numeric value is read from a text file, and a numeric value was expected.
107 Invalid enumeration Reported when a text representation of an enumerated constant cannot be created in a call to str or write(ln).
150 Disk is write-protected (Critical error)
151 Bad drive request struct length (Critical error)
152 Drive not ready (Critical error)
154 CRC error in data (Critical error)
156 Disk seek error (Critical error)
157 Unknown media type (Critical error)
158 Sector Not Found (Critical error)
159 Printer out of paper (Critical error)
160 Device write fault (Critical error)
161 Device read fault (Critical error)
162 Hardware failure (Critical error)
200 Division by zero The application attempted to divide a number by zero.
201 Range check error If you compiled your program with range checking on, then you can get this error in the following cases:

  1. An array was accessed with an index outside its declared range.
  2. Trying to assign a value to a variable outside its range (for instance an enumerated type).
202 Stack overflow error The stack has grown beyond its maximum size (in which case the size of local variables should be reduced to avoid this error), or the stack has become corrupt. This error is only reported when stack checking is enabled.
203 Heap overflow error The heap has grown beyond its boundaries. This is caused when trying to allocate memory explicitly with New, GetMem or ReallocMem, or when a class or object instance is created and no memory is left. Please note that, by default, Free Pascal provides a growing heap, i.e. the heap will try to allocate more memory if needed. However, if the heap has reached the maximum size allowed by the operating system or hardware, then you will get this error.
204 Invalid pointer operation You will get this in several cases:

  • if you call Dispose or Freemem with an invalid pointer
  • in case New or GetMem is called, and there is no more memory available. The behavior in this case depends on the setting of ReturnNilIfGrowHeapFails. If it is True, then Nil is returned. if False, then runerror 204 is raised.
205 Floating point overflow You are trying to use or produce real numbers that are too large.
206 Floating point underflow You are trying to use or produce real numbers that are too small.
207 Invalid floating point operation Can occur if you try to calculate the square root or logarithm of a negative number.
210 Object not initialized When compiled with range checking on, a program will report this error if you call a virtual method without having called its object’s constructor.
211 Call to abstract method Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called.
212 Stream registration error This occurs when an invalid type is registered in the objects unit.
213 Collection index out of range You are trying to access a collection item with an invalid index (objects unit).
214 Collection overflow error The collection has reached its maximal size, and you are trying to add another element (objects unit).
215 Arithmetic overflow error This error is reported when the result of an arithmetic operation is outside of its supported range. Contrary to Turbo Pascal, this error is only reported for 32-bit or 64-bit arithmetic overflows. This is due to the fact that everything is converted to 32-bit or 64-bit before doing the actual arithmetic operation.
216 General Protection fault The application tried to access invalid memory space. This can be caused by several problems:

  1. Dereferencing a nil pointer.
  2. Trying to access memory which is out of bounds (for example, calling move with an invalid length).
217 Unhandled exception occurred An exception occurred, and there was no exception handler present. The sysutils unit installs a default exception handler which catches all exceptions and exits gracefully.
218 Invalid value specified Error 218 occurs when an invalid value was specified to a system call, for instance when specifying a negative value to a seek() call.
219 Invalid typecast Thrown when an invalid typecast is attempted on a class using the as operator. This error is also thrown when an object or class is typecast to an invalid class or object and a virtual method of that class or object is called. This last error is only detected if the -CR compiler option is used.
222 Variant dispatch error No dispatch method to call from variant.
223 Variant array create The variant array creation failed. Usually when there is not enough memory.
224 Variant is not an array This error occurs when a variant array operation is attempted on a variant which is not an array.
225 Var Array Bounds check error This error occurs when a variant array index is out of bounds.
227 Assertion failed error An assertion failed, and no AssertErrorProc procedural variable was installed.
229 Safecall error check This error occurs is a safecall check fails, and no handler routine is available.
231 Exception stack corrupted This error occurs when the exception object is retrieved and none is available.
232 Threads not supported Thread management relies on a separate driver on some operating systems (notably, Unixes). The unit with this driver needs to be specified on the uses clause of the program, preferably as the first unit (cthreads on unix).

Add in the top of the first Pascal unit (usually the project .lpr file)

Источник

Читайте также:  Parsing error the keyword const is reservedeslint

Adblock
detector

Programming newbies or people, who start with developing applications using the Lazarus IDE, may be irritated by some error messages, being displayed
during the build or the execution of a program. Might this little text be helpful to understand, what’s wrong and how to solve the issue.

Message Occurrence Explanation
Error: Can’t create object file: FILENAME (error code: 5). Error: Can’t create executable FILENAME. Build error The object and executable of the program to be build can’t be created, because Lazarus can’t write the file. On Linux, this could have to do with
file or directory access permissions. Usually, the reason is a very simple one: You are trying to rebuild a program, that is actually being executed.
Hint: Variable ARRAY-VARIABLE of a managed type does not seem to be initialized. Build warning This message occurs, if you set the initial length of a dynamic array (for example: SetLength(ARRAY-VARIABLE, 0).
For me personally, this message is nonsense: How could you initialize a dynamic array, before setting its length? Most people, posting in the Lazarus forums,
seem to share my opinion. Another argument, that this hint may safely be ignored, is that with Lazarus versions 1.x, this never happened.
Project PROJECTNAME raised exception class ‘External: SIGSEGV’. At address ADDRESS. Run-time error There was some error in an external module, called by the program. This usually happens, if some variable has a value, that is invalid for a given
function called. The problem with these errors is, that Lazarus usually doesn’t indicate the line in the source code, where the error occurred. Finding these
errors may thus be heavy (I never used the debugger; would this be the solution, to quickly find the error?). According to my own experience, one of
the most frequent reasons is an array index, that is out of the permitted limits, writing some code like for I := 0 to Length
(ARRAY-Variable) do
. The error may also be caused by invalid arguments of a mathematical function, such as negative values, in the case of an
external calculation of a square root.


If you find this text helpful, please, support me and this website by signing my guestbook.

Моя программа завершается с помощью RunError (5), что предполагает, что она не может получить доступ к файлу, что должно быть. Я проверил, и файл используется должным образом, файл не предназначен только для чтения и т. Д. Программа создает файл .dat, если он не существует, и использует его для сохранения. Если я запустил программу, а файл не существует, файл будет создан, но после этого в том же исполнении программа не получит доступ к файлу. Это происходит ТОЛЬКО, если файл был создан в текущем исполнении.

Так вызываются процедуры (код довольно длинный, но я даю вам несколько первых строк, в которых возникает ошибка):

 fileName := 'labSave.dat';
 CreateFile;
 assign(labyrinthFile,fileName);
 writeln(CheckFileSize);

А затем есть каждая из процедур:

procedure Initialize;
begin
    fileName := 'labSave.dat';
    assign(labyrinthFile,fileName);
end;   

procedure CreateFile;
begin
    if not FileExists(fileName) then FileCreate(fileName);
end; 

function CheckFileSize: integer;
begin
    reset(labyrinthFile);
    CheckFileSize := FileSize(labyrinthFile);
    close(labyrinthFile);
end;

1 ответ

Лучший ответ

Согласно форуму Lazarus (http://forum.lazarus.freepascal.org/index. php? topic = 4936.0):

Ошибка выполнения 5 означает отказано в доступе. Возможно, файл доступен только для чтения, и вы используете неправильный (по умолчанию) файловый режим, или вы пытаетесь повторно открыть файл с новым дескриптором файла, не закрывая его раньше (где-то в то время и повторяющиеся циклы, возможно, вы назначаете файл более одного раза, затем сброс не удается?).

Если я правильно сейчас помню, рабочий процесс для создания должен быть следующим:

AssignFile(f, filename); Rewrite(f); CloseFile(f);

И для существующего файла:

AssignFile(f, filename); Reset(f); CloseFile(f);

Видя другие ошибки, обнаруженные в вашем коде с помощью вопросов в комментариях, я настоятельно рекомендую вам уделять больше времени отладке, а когда возникают такие ошибки — вырезать ВСЕ не относящийся к делу код и проверить дизайн своего кода на случаи, подобные вышеизложенным (назначение файла перед его созданием , и т.д.).


2

Kromster
21 Май 2014 в 12:59

Понравилась статья? Поделить с друзьями:
  • Run time error 70 permission denied vba
  • Run error 106 lazarus
  • Run time error 7 out of memory конструктор сайтов е паблиш
  • Run error 104 lazarus
  • Run time error 62 input past end of file