Author Topic: [MOVED IN GENERAL] I can't import other Unit when using fpWeb in the project  (Read 1356 times)


  • New member
  • *
  • Posts: 7

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



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:

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?


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;
  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
  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']);
  18.   // With I delete the following line the project is compiled without errors:
  19.   CaminhoArquivo := gerar(Schema, DataInicial, DataFinal, CodigoUnidade);
  21.   AResponse.ContentType := 'text/plan';
  22.   AResponse.Contents.LoadFromFile(CaminhoArquivo);
  24.   Handled := True;
  25. end;

« Last Edit: December 06, 2018, 04:59:31 pm by giancarloandroid »