Recent

Author Topic: Error code documentation  (Read 344 times)

Ștefan-Iulian Alecu

  • New Member
  • *
  • Posts: 21
Error code documentation
« on: October 03, 2024, 11:10:43 pm »
I'm going through the Free Pascal User's Guide (partially for understanding FPC better and partially for improving the docs). I found this passage at 4.1 General Problems (https://www.freepascal.org/docs-html/current/user/userse14.html#x31-380004.1):

Quote
IO-error -2 at ... : Under linux you can get this message at compiler startup. It means typically that the compiler doesn’t find the error definitions file. You can correct this mistake with the -Fr (see page 108) option under linux.

My educated guess is that 2 stands for ENOENT (File not found)... but why's it negative? Anyway, I looked into the documentation and found https://www.freepascal.org/docs-html/current/rtl/sysutils/einouterror.errorcode.html, which says:

Quote
ErrorCode contains the error code from the I/O operation which raised the EInoutError exception. An explanation of the error codes can be found in the user's manual.

But when looking into every manual available... no mention of the error codes. What are they and where can I find them? My best guess would be https://gitlab.com/freepascal.org/fpc/source/-/blob/main/rtl/objpas/sysutils/sysutils.inc#L436-482, but it isn't quite clear if this is what actually sets the error code for an EInOutError (and also what the exact error messages are, since I am not sure where to look for these @S... pointers). I also was unable to reproduce the IO error -2, so is it still a thing or just something that didn't get removed in the docs?

Thanks for your attention.

TRon

  • Hero Member
  • *****
  • Posts: 3619
Re: Error code documentation
« Reply #1 on: October 03, 2024, 11:16:13 pm »
But when looking into every manual available... no mention of the error codes. What are they and where can I find them?
I assume that quote is referring to runtime errors from the user manual
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Ștefan-Iulian Alecu

  • New Member
  • *
  • Posts: 21
Re: Error code documentation
« Reply #2 on: October 03, 2024, 11:23:24 pm »
But when looking into every manual available... no mention of the error codes. What are they and where can I find them?
I assume that quote is referring to runtime errors from the user manual

D'OH! I didn't look there (I was too laser focused on IO errors and didn't consider runtime errors). :facepalm:

Could you (or anyone else who happens to read this) also help me understand this part:
Quote
Error : File not found : xxx or Error: couldn’t compile unit xxx: This typically happens when your unit path isn’t set correctly. Remember that the compiler looks for units only in the current directory, and in the directory where the compiler itself is. If you want it to look somewhere else too, you must explicitly tell it to do so using the -Fu (see page 108) option. Or you must set up a configuration file.

Specifically, when exactly does the latter error happen (and the former)? What's the difference between them from the compiler's view? I am not sure how to split these errors into separate sections. As it's phrased, the second type of error shouldn't happen if the unit itself has any sort of syntactic errors, because it would mean that it found the unit. I feel like the explanation that starts with "This typically happens[...]" only applies for File not found (in which case it makes sense), but what about Couldn't compile unit?

TRon

  • Hero Member
  • *****
  • Posts: 3619
Re: Error code documentation
« Reply #3 on: October 03, 2024, 11:37:13 pm »
Could you (or anyone else who happens to read this) also help me understand this part:
uhm. I never given that sentence that much thought even though I use FPC for ages.

As an educated guess:
Whenever the compiler 'searches' for a unit the compiler usually is satisfied with a compiled unit (.ppu). whenever there is need to recompile the unit (there can be several reasons for that) the source of the unit is required. If it unable to locate the source then it might perhaps produce the second error (though technically it is also a file not found).

Perhaps some else is around who is able to provide a more educated explanation.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Ștefan-Iulian Alecu

  • New Member
  • *
  • Posts: 21
Re: Error code documentation
« Reply #4 on: October 04, 2024, 07:09:10 pm »
I don't know if this is a "bump", but can someone look at what I asked, please?

 

TinyPortal © 2005-2018