Forum > General

Error: Undefined symbol

(1/1)

ezlage:
Friends,

I looked in others topics but I didn't found a solution to my problem:


--- Quote ---bookman.lpr(23,1) Error: Undefined symbol: UNDABERTURA_CRIADBF$ANSISTRING$$BOOLEAN
--- End quote ---

Follows the source-code:

bookman.lpr

--- Code: ---program bookman;

{$mode objfpc}{$H+}

uses
  ezsharemem,
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, dbflaz, undabertura, undmoddados
  { you can add units after this };

{$R *.res}

begin
  Application.Title:='Bookman';
  Application.Initialize;
  Application.CreateForm(TFrmAbertura, FrmAbertura);
  Application.CreateForm(TModDados, ModDados);
  FrmAbertura.LblVer.Caption:=versao;
  Application.Run;
end.
--- End code ---

Relevant parts of undabertura.pas

--- Code: ---unit undabertura;

{$mode objfpc}{$H+}

interface

uses
  StrUtils, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  StdCtrls;

type

  { TFrmAbertura }

  TFrmAbertura = class(TForm)
    ImgLogo: TImage;
    ImgAbertura: TImage;
    LblVer: TLabel;
    LblMsg1: TLabel;
    LblMsg2: TLabel;
    LblMsg3: TLabel;
    procedure FechaESC(Sender: TObject; var Key: char);
    procedure Prossegue(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

const
  versao:string='rc1';

var
  FrmAbertura:TFrmAbertura;
  carregado:boolean=False;
  falha:boolean=False;

function CriaDBF(arquivo:string):boolean; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} external; //HERE

implementation

uses undmoddados;

{ TFrmAbertura }

procedure TFrmAbertura.Prossegue(Sender:TObject);
var
  c,ndep:integer;
begin

end;

procedure TFrmAbertura.FechaESC(Sender:TObject; var Key:char);
begin
  if Key=#27
   then Application.Terminate;
end;

{$R *.lfm}

end.

--- End code ---

Relevant parts of moddados.pas

--- Code: ---unit undmoddados;

{$mode objfpc}{$H+}

interface

uses
  Dialogs, StrUtils, Classes, SysUtils, dbf, db, FileUtil;

type

  { TModDados }

  TModDados = class(TDataModule)
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  ModDados: TModDados;
  bookman: TDbf;
  histo: TDbf;

function CriaDBF(arquivo:string):boolean; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} export; //HERE

implementation

{ TModDados }

function CriaDBF(arquivo:string):boolean; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}; export; //HERE
begin
  case AnsiIndexStr(LowerCase(arquivo),['bookman.dbf','histo.dbf']) of
    0: begin
      bookman:=TDbf.Create(ModDados);
      with bookman do begin
        Active:=False;
        FilePathFull:={$IFDEF MSWINDOWS}'.\'{$else}'./'{$endif};
        TableName:=arquivo;
         with FieldDefs do begin
          Clear;
          Add('srv_loc',ftstring,40);
          Add('prt_loc',ftstring,40);
          Add('bds_loc',ftstring,40);
          Add('usr_loc',ftstring,40);
          Add('snh_loc',ftstring,40);
          Add('chv_loc',ftstring,40);
          Add('ver_loc',ftstring,40);
        end;
        try
          CreateTable;
          Active:=True;
        except
          result:=False;
        end;
        if Active
          then result:=True;
        Active:=False;
      end;
    end;
    1: begin

    end;
  end;
end;

{$R *.lfm}

end.

--- End code ---

What am I doing wrong?
Thanks!

User137:
Should it be {$IFDEF WINDOWS} ?

ezlage:
Friend,

I tested without the {$IFDEF} but the problem persists.

felipemdc:
Try defining a name for it:

function CriaDBF(arquivo:string):boolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} external name 'CRIADBF';

and in the other file

function CriaDBF(arquivo:string):boolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} public name 'CRIADBF';

ezlage:
So easy, but I'm learning...

You solved my problem!
Thank you so much!

Regards,
Ezequiel Lage
Brazil

Navigation

[0] Message Index

Go to full version