Recent

Author Topic: [SOLVED]"Unit expected but Program found!?" Whats wrong?  (Read 4061 times)

440bx

  • Hero Member
  • *****
  • Posts: 4063
Re: Whats wrong?
« Reply #15 on: November 01, 2019, 02:03:52 am »
What follows is a guess but, based on the fpc compile image you posted, you have a program (emphasis on program) called "windows.pas" (the filename.) Your program uses the unit "crt" which in turn I believe uses "windows" (filename: windows.pas), since there is a "windows.pas" file in your program directory, the compiler opens your local "windows.pas" expecting it to be the "windows" unit.

If the above guess is correct, the compiler has every right to complain because there are two "program" clauses present and in addition to that, the "windows.pas" file it finds is _not_ the implementation of the "windows" unit.

rename your local windows.pas to something like "MyWindows.pas" and try compiling your "xyz" (or whatever its name is) program again.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

coradi

  • Full Member
  • ***
  • Posts: 148
Re: Whats wrong?
« Reply #16 on: November 01, 2019, 07:23:54 am »
YES:-)
That's it:-)
Now it seem to work:-)
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: [SOLVED]"Unit expected but Program found!?" Whats wrong?
« Reply #17 on: November 01, 2019, 08:10:17 am »
[OUCH], and I think that justifies a certain amount of confudion on the part of the OP :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Whats wrong?
« Reply #18 on: November 01, 2019, 08:13:03 am »
What follows is a guess but....

Well spotted indeed !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018