2015-01-04 13 views
-1

개인 형 선언은 오류를 던지고있다? 내 코드는 다음과 같습니다가 오류 =>개인 유형 선언에 오류가 있습니까?

사양 파일

package rec is 
type t is private; 
give_public_acess:Constant t; 
private 
    type int_array is array(1..5)of integer; 
    type t_type is record 
    max:integer:=0; 
    data:int_array; 
    end record; 
    give_public_acess:constant t_type:=(0,(others=>1)); --error is here adacore site says these is good but throwing error? 
    end rec; 

답변

1

"개인 형 t의 전체 신고 누락"나는 컴파일하면 해결하는 데 도움이하시기 바랍니다 코드 나는 2 오류 메시지를 얻을 :

rec.ads:2:07: missing full declaration for private type "t" 
rec.ads:10:03: type does not match declaration at line 3 

이들은 모두 당신은 공공 부분,121의 유형 t를 호출하기 때문에은 개인 부분입니다. 첫 번째 의미는 정확히 무엇을 말합니다. 그래서,이 코드와 오류 메시지를 산재 : 두 번째는 공공 부분에 당신이

give_public_acess:Constant t; 

와 민간 부분

give_public_acess:constant t_type 

난 당신이 -gnatl (전체 목록) 컴파일하려고 제안에

말 때문이다 너는 얻을

1. package rec is 
2. type t is private; 
      | 
    >>> missing full declaration for private type "t" 

3. give_public_acess:Constant t; 
4. private 
5. type int_array is array(1..5)of integer; 
6. type t_type is record 
7.  max:integer:=0; 
8.  data:int_array; 
9. end record; 
10. give_public_acess:constant t_type:=(0,(others=>1)); --error is here adacore site says these is good but throwing error? 
     | 
    >>> type does not match declaration at line 3 

11. end rec;