Lazarus

Programming => Packages and Libraries => Lazarus Extra Components => Topic started by: giancarloandroid on December 06, 2018, 04:49:20 pm

Title: [MOVED IN GENERAL] I can't import other Unit when using fpWeb in the project
Post by: giancarloandroid on December 06, 2018, 04:49:20 pm
Updated:

I moved this question for Programming > General, I think makes more sense.

http://forum.lazarus.freepascal.org/index.php/topic,43455.msg304118.html

Sorry.

-------

I can't import a Unit created by me in a Pascal project using Lazarus IDE and fpWeb framework that is used for open a HTTP connection.

The following error occurs when I compile the project with Unit x_inicializacao implemented in the Main file:

Quote
Projeto.lpr(18,1) Error: Error while linking

I'm using the TFPWebModule class and I need call a function of the Unit that I created in the procedure of the fpWeb:

Code: Pascal  [Select][+][-]
  1.     procedure DataModuleRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);

How can I proceed?

Thanks.

Main file (Main.pas):

Code: Pascal  [Select][+][-]
  1. // x_inicializacao import, with I delete this import the project is compiled without errors.
  2. uses SysUtils, Classes, httpdefs, fpHTTP, fpWeb, x_inicializacao;
  3.  
  4. procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest;
  5.   AResponse: TResponse; var Handled: Boolean);
  6. var CaminhoArquivo: String;
  7.     Schema: String;
  8.     DataInicial: String;
  9.     DataFinal: String;
  10.     CodigoUnidade: Integer;
  11. begin
  12.  
  13.   Schema := ARequest.QueryFields.Values['Schema'];
  14.   DataInicial := ARequest.QueryFields.Values['DataInicial'];
  15.   DataFinal := ARequest.QueryFields.Values['DataFinal'];
  16.   CodigoUnidade := StrToInt(ARequest.QueryFields.Values['CodigoUnidade']);
  17.  
  18.   // With I delete the following line the project is compiled without errors:
  19.   CaminhoArquivo := gerar(Schema, DataInicial, DataFinal, CodigoUnidade);
  20.  
  21.   AResponse.ContentType := 'text/plan';
  22.   AResponse.Contents.LoadFromFile(CaminhoArquivo);
  23.  
  24.   Handled := True;
  25. end;

TinyPortal © 2005-2018