Solved

Need help compiling a delphi program

Posted on 2004-09-16
6
1,179 Views
Last Modified: 2008-01-16
Hi ..
I need help compiling a delphi application.I do not know Delphi at all.
I am trying to compile this project but it gives me error on

A:=VarArrayCreate([0, 25], varVARIANT);


The error message is pas(174) Undeclared identified 'vararraycreate'

Am i missing any "Include file" or something that tells compiler what vararray create is.As afar as i know the syntax of this vararraycreate is correct.

Thanks.

FUNCTION GETWINDIR(SENDER: TOBJECT): STRING;
VAR
XX: STRING;
A: VARIANT;
ENVPSTR: PCHAR;
STOP: BOOLEAN;
NN:INTEGER;
NA: INTEGER;
N: INTEGER;
STR_WINDIR: STRING;
BEGIN
STR_WINDIR:='';
STOP:=FALSE;
GETMEM(ENVPSTR,512);
ENVPSTR:=GETENVIRONMENTSTRINGS();
A:=VarArrayCreate([0, 25], varVARIANT);
NN:=1;
NA:=0;
A[NA]:='' ;
REPEAT
     IF ENVPSTR[NN]<>#0 THEN
          BEGIN
          A[NA]:=A[NA]+ENVPSTR[NN];
          END
       ELSE
          BEGIN
          IF ENVPSTR[NN+1]=#0 THEN
               STOP:=TRUE
            ELSE
               BEGIN
               NA:=NA+1;
               A[NA]:='';
               END;
          END;
     NN:=NN+1;
UNTIL STOP ;
FREEENVIRONMENTSTRINGS(ENVPSTR);
FOR N:=1 TO NA DO
     BEGIN
     NN:=POS('=',A[N]);
     IF NN<>0 THEN
          BEGIN
          XX:=COPY(A[N],1,NN-1);
          IF XX='windir' THEN
               BEGIN
               STR_WINDIR:=COPY(A[N],NN+1,255);
               BREAK;
               END;
          END;
     END;
RESULT:=STR_WINDIR;
END;

FUNCTION TRIMCOMMASPACE(STR_IN: STRING): STRING;
{THIS FUNCTION IS INTENDED FOR USE WITH NUMBERS - ENTERED AS STRINGS -
WHICH MAY CONTAIN COMMAS OR SPACES AS THOUSANDS SEPARATORS.
THE FUNCTION RETURNS THE INPUT STRING, LESS COMMAS/SPACES}
VAR
INTCNT: INTEGER;
STR_OUT: STRING;
BEGIN
STR_OUT:='';
FOR INTCNT:=1 TO LENGTH(STR_IN) DO
     BEGIN
     IF (STR_IN[INTCNT]<>',') AND (STR_IN[INTCNT]<>' ') THEN
          STR_OUT:=STR_OUT+STR_IN[INTCNT];
     END;
RESULT:=STR_OUT;
END;
0
Comment
Question by:vikas1675
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
Validor earned 250 total points
ID: 12077667
You are likely correct.  If the identifier is undeclared, then you're usually missing a unit in the USES clause.  In Delphi 5, it is declared in the SYSTEM unit, and is always available (the SYSTEM unit is always included in your project).  In Delphi 6 and 7, it is declared in the VARIANTS unit.  

It is strange that this code (which I assume you inherited) once compiled (again, assuming) but now won't.  The most likely cause of this is that the code was written in Delphi 5 and is now being compiled in Delphi 6 or 7.  That's okay.  This problem is not hard to fix.  If possible, try compiling the ORIGINAL source under Delphi 5 to see what happens (that is, source that you have not loaded and SAVED in Delphi 6+).

To fix the problem, add the word VARIANTS to the USES clause list.  There are two USES clauses in each Delphi unit.  The IMPLEMENTATION USES is the USES clause that appears immediately after the keyword IMPLEMENTATION.  If you put it here, it has minimum scope.  If it still causes any problems, you may add it to the USES clause that immediately follows the INTERFACE keyword (at the very top of the unit).  That has a wider scope.

3 examples (just to give you an idea):

uses variants;

uses
  Windows, Messages, Variants, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs;

uses
  Windows,
  SysUtils,
  Variants;

A UNIT, of course, is synonymous with a single source file, such as a .PAS file (mostly).
0
 

Author Comment

by:vikas1675
ID: 12078096
You are absolutely correct.The application was coded in ver 5 and now i am trying to compile it in ver 7

It was missing Classes too.So I added that and that part is compiling .
So thanks a ton for your help.

I have one more question.
The program has an interface to oracle.It is lookiung for ora.pas.
I serched for Odac on the net and found odac by crlab.I downloaded and installed it but didn't help.The program won't compile now as it can't find this ora.pas file.
Any clues??
0
 

Author Comment

by:vikas1675
ID: 12078306
I looked at older version of Delphi and ora.pas exists in program files\borland\odac\lib\ora.pas but on version 7 it is not there.
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 

Author Comment

by:vikas1675
ID: 12078611
Sorry..I was wrong.there is no ora.pas in ver 5.0 too.
0
 
LVL 3

Expert Comment

by:Validor
ID: 12078784
I have no ora*.pas on my system (which includes Delphi 3, 5, 6, 7, 8).  This tells me that in the Delphi 5 IDE, someone installed a third-party component which used this .pas file.  When you load the project into Delphi 7, did you get a popup telling you that a component was missing?  

Try a GREP search to find ora.pas in your Delphi 5 subdirectories.  It may reveal a .DPK file that contains the text.  

This may be harder to fix.  If this is the case, you'll have to install that component into Delphi 7, or rip it out and replace it with something else.  Not all Delphi 5 components will compile in Delphi 6 and 7.  Starting with Delphi 6, it forces components to follow a new rule.  Those that don't have to be converted to work in Delphi 6 and 7.  Not component designers complied.  If you have this problem, here is a URL that tells you how to fix it.

http://bdn.borland.com/article/0,1410,27717,0.html

Remember this link.  Everybody needs it at some point.  :)
0
 

Author Comment

by:vikas1675
ID: 12078973
When i opened the application in ver 7 then a bunch of errors showed up .I downloaded the ODAC from www.crlab.com/odac/  and the errors went away.
Actually this application was written by a programmer outside our company.It was a one man show.he passed away and now it came to me.So there is no way to know what he was using.I am an Oracle programmer and have absolutely no idea of Delphi.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this post we will learn different types of Android Layout and some basics of an Android App.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Progress

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question