簡體   English   中英

我如何使用#include 來完成這項工作? 直接放入代碼中時效果很好

[英]How do I go about making this work with a #include? It works fine when dropped straight into the code

我有一段代碼要#include 在我的 z/OS Metal C 程序中,當它只是程序的一部分時它工作正常,但是當我將它放入 ah 文件並#include 它時,代碼不會編譯。

我已經成功地讓這段代碼在沒有#include 的情況下工作。 我確定我忽略了與#include 相關的內容...

此代碼有效:

    #pragma margins(2,72)                                                  
    *#if 0!=0                                                              
    Test     DSECT                                                         
    Test@    DS A                                                          
    TestINT  DS F                                                          
    TestChar DS C                                                          
     .ago end                                                              
    *#endif                                                                
    *struct Test {                                                         
    *  void *Test1;                                                        
    *  int TestInt;                                                        
    *  char TestChar;                                                      
    *};                                                                    
    *#if 0!=0                                                              
    .end                                                                   
     MEND                                                                  
    *#endif                                                                
     #pragma nomargins

給出如下所示的編譯器 output:

      207       |#pragma margins(2,72)                                            
      207       +                                                                 
      208       |#if 0!=0                                                         
      214       |#endif                                                           
      215       |struct Test {                                                    
      216       |  void *Test1;                                                   
    5650ZOS V2.1.1 z/OS XL C                          'SSAF.METALC.C(CKKTHING)'   


                                              * * * * *   S O U R C E   * * * * * 

     LINE  STMT                                                                   
                 *...+....1....+....2....+....3....+....4....+....5....+....6....+
      217       |  int TestInt;                                                   
      218       |  char TestChar;                                                 
      219       |};                                                               
      220       |#if 0!=0                                                         
      223       |#endif                                                           
      224       |#pragma nomargins                                                                                                    

但是,當我將代碼放入這樣的#include 文件時:

    EDIT       SSAF.METALC.H(CKKTEST)
    Command ===>                     
    ****** **************************
    000001 *#if 0!=0                 
    000002 Test     DSECT            
    000003 Test@    DS A             
    000004 TestINT  DS F             
    000005 TestChar DS C             
    000006  .ago end                 
    000007 *#endif                   
    000008 *struct Test {            
    000009 *  void *Test1;           
    000010 *  int TestInt;           
    000011 *  char TestChar;         
    000012 *};                       
    000013 *#if 0!=0                 
    000014 .end                      
    000015  MEND                     
    000016 *#endif                   
    ****** **************************

並將其包含在我的 Metal C 程序中:

    EDIT       SSAF.METALC.C(CKLTHING) - 01.00
    Command ===>                              
    000205 #include"ckkprolg.h"               
    000206                                    
    000207 #pragma margins(2,72)              
    000208  #include"ckktest.h"               
    000209  #pragma nomargins                   

我收到一堆錯誤消息:

      205       |#include"ckkprolg.h"               /* Include assembler macros needed                        
      206       |                                      for Metal C prolog and epilog  */                      
      207       |#pragma margins(2,72)                                                                        
      207       +                                                                                             
      208       |#include"ckktest.h"                                                                          
    *=ERROR===========>     CCN3275 Unexpected text 'struct' encountered.                                     
    *=ERROR===========>     CCN3166 Definition of function Test requires parentheses.                         
    *=ERROR===========>     CCN3275 Unexpected text 'void' encountered.                                       
    5650ZOS V2.1.1 z/OS XL C                          'SSAF.METALC.C(CKLTHING)'                    10/04/2019 


                                              * * * * *   S O U R C E   * * * * *                             

     LINE  STMT                                                                                               
                 *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9...
    *=ERROR===========>     CCN3045 Undeclared identifier Test1.                                              
    *=ERROR===========>     CCN3275 Unexpected text 'int' encountered.                                        
    *=ERROR===========>     CCN3045 Undeclared identifier TestInt.                                            
    *=ERROR===========>     CCN3275 Unexpected text 'char' encountered.                                       
    *=ERROR===========>     CCN3045 Undeclared identifier TestChar.                                           
    *=ERROR===========>     CCN3046 Syntax error.                                                             
    *=ERROR===========>     CCN3273 Missing type in declaration of theESTAEXStatic.                           
      209       |#pragma nomargins                                                                            

包含文件缺少#pragma margins 由於它是文件級指令,因此它需要存在於每個源文件中。 請參閱IBM Knowledge Center ,其中說:“ #pragma margins指令指定的設置僅適用於找到它的源文件或包含文件。它對其他包含文件沒有影響。”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM