Using other written functions in a unit

Please discuss general Delphi programming topics here.

Using other written functions in a unit

Postby Wardlow » May 31st, 2007, 10:11 pm

I created a unit to store functions. However within the unit where I create the fucntion. I would like to use other functions in other units, to help create my function. I tried to write ...
Code: Select all

Uses
// wherever my function is located

However, it doesn't work
Suggestions?

Ty
Wardlow
Junior Member
Junior Member
 
Posts: 38
Joined: May 31st, 2007, 10:08 pm

Postby Kambiz » May 31st, 2007, 10:21 pm

In the uses clause, you must include only the unit names. However, the location of referenced units should be in Delphi's search path. Go to Delphi's options and include path to your units there.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Wardlow » May 31st, 2007, 10:44 pm

Kambiz,

Thank you for your reply. StrUtils is the location where the function I need is. My function works in the main program if I write "uses strUtils" So in the unit I am creating I write...
Code: Select all

uses
  StrUtils;

unit TextFunctions;

interface

// functions


.. so are you saying I should go to options and tell it to look for "StrUtils"??
... however I am getting an error
Wardlow
Junior Member
Junior Member
 
Posts: 38
Joined: May 31st, 2007, 10:08 pm

Postby Kambiz » June 1st, 2007, 1:41 am

Seems the problem is something else.

The uses clause must be after interface keyword.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Christine123 » June 1st, 2007, 5:07 am

that's exactly what the problem was. Thank you very much for helping me
Christine123
Junior Member
Junior Member
 
Posts: 25
Joined: May 28th, 2007, 10:28 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 8 guests

cron