Recent

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

440bx

  • Hero Member
  • *****
  • Posts: 2000
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 on Windows 7 64bit.

coradi

  • Jr. Member
  • **
  • Posts: 91
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
Wind XP / 7 / 10

MarkMLl

  • Hero Member
  • *****
  • Posts: 1244
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
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

dbannon

  • Hero Member
  • *****
  • Posts: 1153
    • 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 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

 

TinyPortal © 2005-2018