Im using CodeGear Delphi 2009 Builder. I also installed C++ builder so i have all the .c .h includes.

I downloaded the source of an application and without making any changes i tried to compile. I get many errors in most units:

[IMG]http://img376.imageshack.us/img376/6752/26142144un0.jpg[/IMG]

I've spent hours trying everything. Some of the functions called seem to come from C++ includes (wtype.h). I've tried adding it as a recource, compiling it into a dll. I'm lost. Any help here?

Recommended Answers

All 15 Replies

Whats in your projects path satements? Does a simple hello world program work?

um, .c and .h files maybe, but the code you showed was pascal.

I'm beginning to think that there are some issues with the includes, or paths like you said. All the errors are coming from the two missing includes.

The Compiler is installed to C:\Program Files\Borland\BDS\4.0\

Library Paths:$(BDS)\lib;$(BDS)\Imports;$(BDS)\lib\Indy10;

Browsing Paths:$(BDS)\source\Win32\vcl;$(BDS)\source\Win32\rtl\common;$(BDS)\source\Win32\rtl\sys;$(BDS)\source\Win32\rtl\win;$(BDS)\source\Win32\WebSnap;$(BDS)\source\ToolsAPI;$(BDS)\source\Win32\IBX;$(BDS)\source\Win32\Internet;$(BDS)\source\Win32\Property Editors;$(BDS)\source\Win32\soap;$(BDS)\source\win32\xml;$(BDS)\source\Win32\db;$(BDS)\source\Win32\Decision Cube;$(BDS)\source\Indy10

Debug DCU paths: $(BDS)\lib\Debug;$(BDS)\lib\Debug\Indy10

------------------
As for project Options:

Search Path: $(BDS)\lib\Debug;$(BDS)\lib\Debug\Indy10;C:\Program Files\Borland\BDS\4.0\lib\Debug;

And that's all i could find.
-----------------------------------------------------------
My /lib/ contains many .dcu files including Windows.dcu and ShellAPI.dcu. Those are the ones I'm trying to include? Or am i trying to include the .pas versions?

Sorry if i'm way off, i've never coded that much. But i appreciate the help greatly.

All the smiley faces should be replaced by Colons. Sorry.

no, it will look for both and as as long as it finds a precompiled dcu with the same timestamp, it will assume its correct.

Does a hello world work?

no, it will look for both and as as long as it finds a precompiled dcu with the same timestamp, it will assume its correct.

Does a hello world work?

Yes, i just made one and it works. You click a button and it changes the a Lable on the form to "Hello World":

unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
 begin
    Caption := 'LOL';
   Label1.Caption := 'Hello World';
 end;

end.

OK, so thats a good sign. Most likely then theres something wrong with the project you loaded, or..

You sure those werent the error insight errors and they were actual compiler errors?

The ones in the picture are not compiler errors.

The project uses a few units including: SYSWSTR.PAS System.pas SysSfIni.pas...and a few others. These are all accounted for in the project directory along with the stub.dpr project file.

When i try to compile i get:

[Pascal Fatal Error] stub.dpr(1): F2063 Could not compile used unit 'System.pas'

I checked out system.pas:

*********************************************************************** }
{                                                                         }
{ Delphi / Kylix Cross-Platform Runtime Library                           }
{ System Unit                                                             }
{                                                                         }
{ Copyright (c) 1988-2001 Borland Software Corporation                    }
{                                                                         }
{ *********************************************************************** }

// KOL version of System unit for Delphi6.
// September, 2001
// (C) by Kladov Vladimir
//
// purpose: make Delphi programs without VCL even smaller.
//
// Changes are marked as {X}

unit System; { Predefined constants, types, procedures, }
             { and functions (such as True, Integer, or }
             { Writeln) do not have actual declarations.}
             { Instead they are built into the compiler }
             { and are treated as if they were declared }
             { at the beginning of the System unit.     }

{$H+,I-,R-,O+,W-}
{$WARN SYMBOL_PLATFORM OFF}

{ L- should never be specified.

  The IDE needs to find DebugHook (through the C++
  compiler sometimes) for integrated debugging to
  function properly.

  ILINK will generate debug info for DebugHook if
  the object module has not been compiled with debug info.

  ILINK will not generate debug info for DebugHook if
  the object module has been compiled with debug info.

  Thus, the Pascal compiler must be responsible for
  generating the debug information for that symbol
  when a debug-enabled object file is produced.
}

interface

(* You can use RTLVersion in $IF expressions to test the runtime library
  version level independently of the compiler version level.
  Example:  {$IF RTLVersion >= 16.2} ... {$IFEND}                  *)

const
  RTLVersion = 14.20;

{$EXTERNALSYM CompilerVersion}

(*
const
  CompilerVersion = 0.0;

  CompilerVersion is assigned a value by the compiler when
  the system unit is compiled.  It indicates the revision level of the
  compiler features / language syntax, which may advance independently of
  the RTLVersion.  CompilerVersion can be tested in $IF expressions and
  should be used instead of testing for the VERxxx conditional define.
  Always test for greater than or less than a known revision level.
  It's a bad idea to test for a specific revision level.
*)


{$IFDEF DECLARE_GPL}
(* The existence of the GPL symbol indicates that the System unit
  and the rest of the Delphi runtime library were compiled for use
  and distribution under the terms of the GNU General Public License (GPL).
  Under the terms of the GPL, all applications compiled with the
  GPL version of the Delphi runtime library must also be distributed
  under the terms of the GPL.
  For more information about the GNU GPL, see
  http://www.gnu.org/copyleft/gpl.html

  The GPL symbol does not exist in the Delphi runtime library
  purchased for commercial/proprietary software development.

  If your source code needs to know which licensing model it is being
  compiled into, you can use {$IF DECLARED(GPL)}...{$IFEND} to
  test for the existence of the GPL symbol.  The value of the
  symbol itself is not significant.   *)

const
  GPL = True;
{$ENDIF}

{ Variant type codes (wtypes.h) }

  varEmpty    = $0000; { vt_empty       }
  varNull     = $0001; { vt_null        }
  varSmallint = $0002; { vt_i2          }
  varInteger  = $0003; { vt_i4          }
  varSingle   = $0004; { vt_r4          }

That just the begging of the file.

Compiling the stub.dpr looks like this:
[IMG]http://img440.imageshack.us/img440/2428/96609634bq3.jpg[/IMG]

EDIT: Also, if this means anything. The system.pas is filled with errors like
"type identifier expected on line ###"

EDIT:

Aiight. System.pas is not a direct part of this project, but just a necessary include that holds some functions for this project. I have another copy of it that came with my copy of Turbo Delphi at \source\Win32\rtl\sys\system.pas

I tried using that one instead of the one that came with the source code, but both are identical so everything remained the same.

OK, first thing to note, error insight is a liar. It can often found to be so.

Now, the error you're getting implies you may have more than one system.pas, you mention you have 2 copies, what happens if you rename the one you have in your project directory? to something else say system2, and leave your uses clause as it is, does the problem go away? Having the wrong versions of system.pas when moving to a unicode compiler from a non unicode compiler is probably a bad thing and I cant see why you'd need it.

Yes, i have two. One in my project folder, and one that came with the compiler. I've done an entire search of the computer and those are the only two.

I tried renaming the one in the project folder, still i get the same error. I tried renaming the one in my compiler folder, still get the same error. I renamed both of them, still got the same error. I'm sure if i delete both of them the error will still be the same.

Also, i put an open bracket under {$IMAGEBASE $19140000} and commented out all the code but the program stub2; part.

Still got the same error.

k, make sure you remove all the .dcu's and stuff too

K. I've tried renaming and deleting everything. There were 2 other system.dcu 's with the compiler. Still got the same error.

It really seems to have nothing to do with the source. I can just delete every line of code and try to compile and still receive the same error.

Any ideas?

K, i just copied all the code into a new console project and it seems to work. =/

Sorry for triple post, couldn't edit.

Didn't work for a while. I created a new project and tried to copy the source but that just started the same problem again.

Because somewhere then you have another system.pas and its upsetting that project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.