Recent

Author Topic: Can't find crt(!?)  (Read 6139 times)

graemejc

  • New Member
  • *
  • Posts: 33
Can't find crt(!?)
« on: December 12, 2021, 01:47:28 am »
This may be the simplest & stupidest question ever on this forum. Please forgive me.

I run the following program ....

Program Q2;
uses
        crt;
begin
end.


... and get the error message ...

Compile Project, Target: Project1.exe: Exit code 1, Errors: 1
Project1.lpr(3,9) Fatal: Cannot find crt used by Q2 of the Project Inspector.

This cannot be a syntax error, hence I am assuming that it's a Lazarus setting that has been corrupted. I have used this type of program on multiple occasions in the past, so am absolutely bamboozled.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1963
  • Former Delphi 1-7, 10.2 user
Re: Can't find crt(!?)
« Reply #1 on: December 12, 2021, 06:26:59 am »
Have you tried Lazarus IDE > Run > Cleanup and Build when in your Q project?
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.3.1
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.3.1

graemejc

  • New Member
  • *
  • Posts: 33
Re: Can't find crt(!?)
« Reply #2 on: December 12, 2021, 07:52:24 am »
I deleted both Lazarus and Free Pascal and re-installed them both. Problem went away. It's annoying that I don't understand why the problem arose and what the "true" (non-reboot) solution is.

Neverethless, appreciate your help. Thanks.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9979
  • FPC developer.
Re: Can't find crt(!?)
« Reply #3 on: December 12, 2021, 02:42:18 pm »
Your program uses Crt and System, and maybe some target specific units that are used to implement Crt. Another such typical unit is e.g. contnrs

It could be that unit Crt is the first unit outside of the core RTL that is being loaded, that usually means that there is something wrong with the unit path, but that the compiler somehow managed to auto add only the core RTL path.

Since the problem is gone, this is more for future people with the problem, but try to verify the -Fu aka unitpath.

 

TinyPortal © 2005-2018