Board index » delphi » I get Cannot run a unit error message plez help

I get Cannot run a unit error message plez help

Hi.

Units are pieces of compiled code from a source file.  They must be
linked to a program, then the routines in them can be called.

For example:
------------ the program file --------------
program test
USES SomeUnit;
begin
 WRITELN( AddNumbers( 3,4 ));
end.
--------------- the unit file ------------
unit SomeUnit;
INTERFACE
 FUNCTION AddNumbers( num1, num2 : integer )  : integer;
IMPLEMENTATION
 FUNCTION AddNumbers( num1, num2 : integer )  : integer;
 BEGIN
  AddNumbers := num1 + num2;
 END;
END.
---------------------------------------------

Compile the program.  It will link in the unit and you will be
"using" the unit.

good luck
-pete

Quote
jft...@total.net wrote:

> Hi!
> Im using TP7 and when i try to use some sources in .pas, i run them
> and get Cannot run a unit error message...

> Im sure this is ok :  the .tpu are in my tp\unit\ directory and in my
> tp config, this is my .tpu dir...

> Please help me !

--
Pete d'Oronzio
Pd' Programming, Inc.
"Where Magic Happens"
http://www.pdprog.com
p...@pdprog.com
 

Re:I get Cannot run a unit error message plez help


Hi!
Im using TP7 and when i try to use some sources in .pas, i run them
and get Cannot run a unit error message...

Im sure this is ok :  the .tpu are in my tp\unit\ directory and in my
tp config, this is my .tpu dir...

Please help me !

Re:I get Cannot run a unit error message plez help


On Mon, 30 Dec 1996 jft...@total.net wrote:

Quote
> Hi!
> Im using TP7 and when i try to use some sources in .pas, i run them
> and get Cannot run a unit error message...

> Im sure this is ok :  the .tpu are in my tp\unit\ directory and in my
> tp config, this is my .tpu dir...

It sounds like you are using one of the IDE's trying to "Run" from a
window that belongs to a unit.  You change to the Program's main window
before trying to Run it.

You "Cannot run a unit" but you can "Compile" it.  You can compile/run a
program.

--
/----------------------------------------------------------------------------\
| Jeff Patterson                       Internet: aa...@fan.nb.ca             |
| Computer Consultant                                                        |
| Author of Trumpet TCP/IP interface routines for Turbo Pascal 7.0           |
| Programmer  | PGP Public Key available from pgp-public-k...@keys.pgp.net   |
| PGP Info: 2048/A8A1DCD5 : E0 9E 9B EF C8 E4 68 3D  B5 9C 72 4C EC 61 DD 7A |
\----------------------------------------------------------------------------/

Re:I get Cannot run a unit error message plez help


Apparently the compiler thinks that you are trying to run a unit.  Make
sure the source code module is not a unit.  If it is a unit, it will say
"unit" at the top, and will have implemntation and interface sections.  You
can compile a unit, but you cannot run it.

jft...@total.net wrote in article <32c6f2f...@news.total.net>...

Quote
> Hi!
> Im using TP7 and when i try to use some sources in .pas, i run them
> and get Cannot run a unit error message...

> Im sure this is ok :  the .tpu are in my tp\unit\ directory and in my
> tp config, this is my .tpu dir...

> Please help me !

Other Threads