Computing: Free Pascal Programming

Lazarus IDE: Some weird error messages.


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.

MessageOccurrenceExplanation
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.