comp.lang.ada
 help / color / mirror / Atom feed
* erreur de compilation !!
@ 2008-01-25 15:51 djalil85
  2008-01-25 16:20 ` Jean-Pierre Rosen
  0 siblings, 1 reply; 2+ messages in thread
From: djalil85 @ 2008-01-25 15:51 UTC (permalink / raw)


J'ai un problème de compilation et j'aurais besoin d'aide SVP:

j'ai codé un exemple simplifié pour présenter le PB:
il s'agit d'un package qui utilise un autre générique, qui à lui même
utilse un autre package générique, et ce dernier implémente une
fonction ("superieure") dont a besoin le premier package.

1)****************************************************************CODE
entier_paquetage.ads-------------------------------------------------------
with Operations_Paquetage;
package Entier_Paquetage is
   type Entier is new integer;
   --instanciation de : operations
   package operations_Instance is
     new Operations_paquetage(
                              Entier
                              );
   use Operations_Instance;
end Entier_Paquetage;

entier_paquetage.adb-------------------------------------------------------
with Ada.Text_Io;
package body Entier_Paquetage is
   B: Boolean;
   X: Entier;
   Y: Entier;
   Z: Entier;
begin
   Init_Entier(X, 2);
   Init_Entier(Y, 3);
   Z:=Addition(X, Y);
   B:= Superieure(X,Y);
end Entier_Paquetage;

operations_paquetage.ads_______________________________________________________
with Comparaison_Paquetage;

generic

   type Objet is private;
package Operations_Paquetage is
   procedure Init_Entier(X: Objet; Val: Integer);
   function Addition(X: Objet; Y: Objet) return Objet;

   package Comparaison_Instance is
     new Comparaison_Paquetage(
                               Objet
                               );
   use Comparaison_Instance;
end Operations_Paquetage;


operations_paquetage.adb_______________________________________________________
package body Operations_Paquetage is
   procedure Init_Entier(X: Objet; Val: Integer) is
   begin
      X:=Val;
   end;

   function Addition(X: Objet; Y: Objet) return Objet is
   begin
      return X+Y;
   end;
end Operations_Paquetage;

comparaison_paquetage.ads%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
generic

   type Objet is private;
package Comparaison_Paquetage is
   function Superieure(X: Objet; Y: Objet) return Boolean;
end Comparaison_Paquetage;


comparaison_paquetage.adb%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
package body Comparaison_Paquetage is
   function Superieure(X: Objet; Y: Objet) return Boolean is
   begin
      return X>Y;
   end ;
end Comparaison_Paquetage;

2)*****************************************************************ERREUR
COMPIL:
gcc -c entier_paquetage.adb
entier_paquetage.adb:4:01: spec of this package does not allow a body
entier_paquetage.adb:20:08: "Superieure" is not visible
entier_paquetage.adb:20:08: non-visible declaration at
comparaison_paquetage.ads:7


3)******************************************************************QUESTION:
la fonction superieure n'est pas reconnue
pour y remédier, faut t-il absolument instancier comparaison_paquetage
au NIVEAU de entier_paquetage ??????

 merci d'avance.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: erreur de compilation !!
  2008-01-25 15:51 erreur de compilation !! djalil85
@ 2008-01-25 16:20 ` Jean-Pierre Rosen
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Pierre Rosen @ 2008-01-25 16:20 UTC (permalink / raw)


djalil85@hotmail.fr a �crit :
> J'ai un probl�me de compilation et j'aurais besoin d'aide SVP:
> 
If you want to post in French, please use fr.comp.lang.ada

But we'll forgive you since it is the first time...

> entier_paquetage.adb:4:01: spec of this package does not allow a body
Si la spec ne demande pas un corps, le corps n'est pas autoris�. On peut 
forcer un corps en mettant "pragma elaborate_body;" dans la spec.

> entier_paquetage.adb:20:08: "Superieure" is not visible
> entier_paquetage.adb:20:08: non-visible declaration at
> comparaison_paquetage.ads:7
Il faut rendre le paquetage o� est d�clar�e la fonction visible par
    use Operations_Instance.Comparaison_Instance;

-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-25 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-25 15:51 erreur de compilation !! djalil85
2008-01-25 16:20 ` Jean-Pierre Rosen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox