Can't find unit Crt lazarus / 67-Windows ---------------------------------------------------------------------- janred · 2016-06-10 03:04 I have been using Free Pascal 2.6.4 for quite a while but when I upgraded to 3.0.0, it will not compile programs that Use the Crt Unit which run fine on the earlier version. Any suggestions? ---------------------------------------------------------------------- bee · 2016-06-10 03:31 What's the error message? I can confirm that FPC 3.0.0 is still able to compile a program that uses the CRT unit just fine. I've tried it myself on a Linux box. ---------------------------------------------------------------------- balazsszekely · 2016-06-10 04:06 It works on windows too(just tested). ---------------------------------------------------------------------- Leledumbo · 2016-06-10 04:27 Quote from: janred on June 10, 2016, 05:04:51 amAny suggestions? Describe "will not compile" as precise as possible, we're not oracles and that phrase could have 10 meanings or so. ---------------------------------------------------------------------- Thaddy · 2016-06-10 06:48 The only thing I can think of is that the compiler is not in the path. Note, not the crt unit, no, the compiler binary, i.e. fpc and ppc386 and or ppcx64 Add the path... Oh, I can think of another: old fpc.cfg. Open the fpc.cfg and look if there are any paths in it and that the paths are correct for 3.0, not 2.6.4. ---------------------------------------------------------------------- marcov · 2016-06-10 09:48 Sounds like an unit path problem, either in the fpc.cfg (commandline use, lazarus) or configuration (textmode IDE) ---------------------------------------------------------------------- janred · 2016-08-18 00:24 Sorry I haven't been able to get back to this but Free Pascal 3.0.0 still isn't recognising the Crt Unit. Its fine with Maths and SysUtils. Using Windows 7. Have checked the fpc.cfg and the paths seem fine but (sorry) not sure how to change/check the path to the compiler. Don't seem to have ppcx64 but do have ppc386.exe The message is Fatal: Can't find unit Crt used by ... I have just had my drive reimaged and reinstalled both 2.6.4 and 3.0.0 but stuck with the same issue. ---------------------------------------------------------------------- molly · 2016-08-18 03:23 Instead of keeping yourself and helpers in the dark, compile the project that generates this error for you with the compiler option -va and post the output to your next post. ---------------------------------------------------------------------- Handoko · 2016-08-18 04:14 Some weeks ago, I failed to make CRT unit to work on my Ubuntu Mate 64 bit Lazarus 1.6 FPC 3.0.0 pc. I found an old laptop and installed the latest version of Lazarus/FPC, and it works on WinXP on the first attempt. ---------------------------------------------------------------------- janred · 2016-08-26 00:48 I have attached a screen shot of the error message I am getting along with the same program compiled using 2.6.4. I am not using Lazarus and I get this on two different computers, both running Windows 7. ---------------------------------------------------------------------- molly · 2016-08-26 01:32 @janred: You don't have your unit path set-up correctly, hence the question to view all messages (-va option) so that we/you can read that. Note that every mode (debug, normal, release) has it's own individual unit directory settings. To whom it may concern: * molly kicks those that still believe in the fairy-tales from MS that using appdata for storing program settings is the way things should be done. And no, repeatedly automatically reverting to that location without user consent is not the way to go. ---------------------------------------------------------------------- janred · 2016-08-26 01:59 Okay, thanks. I have looked in the fpc.cfg file and all paths seem to point to 3.0.0. I am assuming that this would be the relevant section: # searchpath for units and other system dependent things -FuC:\FPC\3.0.0/units/$fpctarget -FuC:\FPC\3.0.0/units/$fpctarget/* -FuC:\FPC\3.0.0/units/$fpctarget/rtl The crt.ppu file is in the rtl-console folder so should the last line be changed to: -FuC:\FPC\3.0.0/units/$fpctarget/rtl-console? ---------------------------------------------------------------------- Leledumbo · 2016-08-26 02:09 Quote from: janred on August 26, 2016, 03:59:07 amOkay, thanks. I have looked in the fpc.cfg file and all paths seem to point to 3.0.0. I am assuming that this would be the relevant section: # searchpath for units and other system dependent things -FuC:\FPC\3.0.0/units/$fpctarget -FuC:\FPC\3.0.0/units/$fpctarget/* -FuC:\FPC\3.0.0/units/$fpctarget/rtl The crt.ppu file is in the rtl-console folder so should the last line be changed to: -FuC:\FPC\3.0.0/units/$fpctarget/rtl-console? The text mode IDE has embedded compiler and it doesn't read fpc.cfg, it has its own fp.cfg which you can configure in the IDE through the Options menu. This includes unit, include and library directory. ---------------------------------------------------------------------- molly · 2016-08-26 02:12 Quote I have looked in the fpc.cfg file and all paths seem to point to 3.0.0. fp-ide uses fp.cfg, not fpc.cfg (as Leledumbo also stated). - start fp-ide - select your 'compilation mode' - Option/Directories - Tab Units Should (at the least) read for you: C:\FPC\3.0.0\units\$FPCTARGET\* The option: - Option\Compiler - tab Verbose - checkmark item ALL And compile, will show you a very comprehensive output in the compiler message window and show you why it cannot find unit CRT. e.g. all the paths it attempts to try will be listed there (yes, a very long list with also other output but, worth exploring in case things fail). ---------------------------------------------------------------------- janred · 2016-08-26 02:42 Okay, thanks. That helped a lot. I copied and pasted the crt.ppu and crt.o into the rtl and folder and it is now working! ---------------------------------------------------------------------- molly · 2016-08-26 02:55 Well, the really sad part there, is that you should not (have to) do that. The unitpath "C:\FPC\3.0.0\units\$FPCTARGET\*" (notice the asterisk) searches your C:\FPC\3.0.0\units\i386-win32\ folder (when compiling for that target) and it automatically searches the subdirectories of that folder for you. For me that one line is enough to be able to compile a projects that includes unit crt, ergo there must be something wrong with your setup/configuration. Also note that you are able to 'export' the message list (saving it into a file) using the right mouse button (there are probably keyboard short-cuts as well but, i do not know them from memory). Note that i did not made the remark in red in one of my previous post just for fun. When you have multiple FPC versions installed this automatically reverting to use the users appdata directory without telling the user is f*cking things up considerably. ---------------------------------------------------------------------- Thaddy · 2016-08-26 08:03 Note that I noted another issue that can cause this on linux: If the fpc 2.6.4 is installed from a distribution the installer will create two symlinks in /usr/local/bin If you built your 3.x.x. from source with make clean install you will have to update those symlinks yourself to point to the new compiler binaries. But that still doesn't explain why the fp ide can't find crt. In any case the most important symlink for a default make clean all install is: e.g. sudo ln -sf /usr/local/lib/fpc/3.0.0/ppcarm /usr/local/bin/ppcarm I think that needs to be changed, because fpc is installed in /usr/local/bin and picks up the wrong ppc (i.e. the old symlink for 2.6.4)