Help with moving MDL application to Ustn Connect - LinkageHeader structure not being found

Hello Everyone,

I am having trouble compiling the MT file to the R file. Below is the message from the BMAKE

The line number 40 in the .H file is "LinkageHeader lnkHdr"

[== Building C:\...\<appname>Linktyp.r, (C:\...\<appname>Linktyp.mt) ==]
rsctype @C:\...\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
MicroStation Type Resource File Generator 03.17.02
C:\...\<appname>Attr.h(40) : error: bad struct/union definition: expected type
C:\...\<appname>Attr.h(40) : error: expected ,, got linkHdr
BMAKE: call trace
    line:   84, C:\...\<appname>.mke
Mon Apr 22 15:26:07 2019, elapsed time: 0:02

typedef struct userDataHeader
{
    LinkageHeader    linkHdr;
    DSIDataHeader    dsiHdr;
} UserDataHeader;

What Include file or update do I need to make so that the MT file can be compiled to .r file

Thanks

Peter

Parents
  • What Include file or update do I need to make so that the MT file can be compiled to .r file

    Ask yourself the reason for the .mt file.  It contains very little except some #includes and the publishStructures directive.  It's job is to convert a C struct to a binary type interpretation stored in a .rsc file.  The type interpretation data is used by the Dialog Manager when passing information between your app. variables and your dialog items.  When the Dialog Manager sees "MyStruct.myVariable" in a dialog item access string it can figure out what type of data is in use and how to transfer data between that dialog item and your app. variable.

    The #includes are straightforward: the circuit example .mt has this...

    #include <RmgrTools/Tools/datadef.r.h>
    #include "circuitcomp.h"
    

    The first includes common Bentley definitions and the second includes the circuit app's own struct definitions...

    typedef struct batteryinfo
        {
        ...
        }BatteryInfo;
    
    typedef struct wireinfo
        {
        ...
        }WireInfo;
    
    typedef struct lightinfo
        {
        ...
        }LightInfo;
    
    typedef struct circuitinfo
        {...
        } CircuitInfo;    
    

    The type resource compiler has all the information it needs to convert those struct definitions in the header file to type resource definitions.  Other files, such as C++ implementation modules, can use those same structure definitions.

    What Include file or update do I need to make so that the MT file can be compiled to .r file

    Create a UserDataHeader.r.h file.  Write the struct definition in that file.  #include only those headers required to make it a valid definition.  Include UserDataHeader.r.h in your .mt file.  Include UserDataHeader.r.h in the C++ files that need it.

     
    Regards, Jon Summers
    LA Solutions

  • Hello Everyone,

    Thank you for taking the time to look at my issue. I created a .H file to add the structures which are not being located. When the .R file is compiled there is an error:

    {DTYPE_ENDSTRUCT,     1,            ,               DTYPE_LONG},

    TestIssue.r(23) : error: expected expression.

     

    I tried to create a test case:

    TestIssue.mke

    #--------------------------------------------------------------------------------------
    #     $Source:  $
    #
    #  $Copyright:  $
    #--------------------------------------------------------------------------------------
    #---------------------------------------------
    # Define macros specific to this example
    #---------------------------------------------
    PolicyFile = $(MDLMKI)MicroStationPolicy.mki
    
    appName = TestIssue
    
    baseDir         = $(_MakeFilePath)
    
    MDLMKI = $(MSMDE)mki/
    MDLINC = ${MSMDE}include/
    
    %include $(MDLMKI)mdl.mki
    #rCompOpts + -i$(MDLINC)
    cIncs + -I$(MDLINC)
    
    mdlLibs = $(MSMDE)library/
    
    #------------------------------------------------------------------------
    # Create & compile the app's type resource using rsctype & rcomp
    #------------------------------------------------------------------------
    $(baseDir)$(appName).r      : $(baseDir)$(appName).mt   
    
    $(baseDir)$(appName).rsc    : $(baseDir)$(appName).r
    
    

    TestIssue.mt

    #include <RmgrTools\Tools\datadef.r.h>
    
    #include    "TestIssue.h"     /*  */
    
    #pragma packedLittleEndianData
    
    createDataDef(ncitemlinkdata,        DSI_NCITEM_LINKAGE);
    

    TestIssue.h

    #include <RmgrTools\Tools\datadef.r.h>
    #include "Ustn_structures.h"
    #if !defined (resource)
    
    #define  DSI_NCITEM_LINKAGE         20
    
    typedef struct dsiheaderdata
    {
       UChar    appType;     // application element Type (max 256)
       UChar    subType;     // application sub class (max 256)
       UShort   elVersion;   // element version changes ONLY if/when this
    } DSIDataHeader;         // appType and subType's Data sturcture changes
    
    typedef struct userDataHeader
    {
       LinkageHeader    linkHdr;
       DSIDataHeader    dsiHdr;
    } UserDataHeader;
    
    typedef struct ncitemdata
    {
    #if defined (dsiRsc)
       short    buff[12];    // 24 total bytes for largest union member
    #else
       union {
          struct {
             int    isManualOrigin;
             int    originPanelType;
          } origin;
          char   panelId[8];
          char   dscrStr[21];
          char   buff[24];
       } u;
    #endif
    } NCItemData;
    
    typedef struct ncitemlinkdata
    {
       UserDataHeader    userHdr;
       NCItemData        ncData;
    } NCItemLinkData;
    
    #endif
    

    Ustn_Structures.h

     

    /*----------------------------------------------------------------------+
    |                                                                       |
    |   Linkage Header - Same for all element user data                     |
    |                                                                       |
    |   Use LinkageUtil::GetWords/setWords to get/set linkage size.           |
    |                                                                       |
    +----------------------------------------------------------------------*/
    struct LinkageHeader
    {
        UInt16      wdMantissa:8;           // mantissa words: wtf if wdExponent=0 
        UInt16      wdExponent:4;           // exponent for words multiplier       
        UInt16      user:1;                 // boolean: user data linkage          
        UInt16      modified:1;             // boolean: user linkage modified      
        UInt16      remote:1;               // boolean: remote linkage             
        UInt16      info:1;                 // boolean: informational linkage      
        UInt16      primaryID;              // User ID number                      
    };
    
    

    The test case creates a.R file and then tries to compile to a .RSC and there is an error because a field is empty.

    Any suggestions?

    Thanks

    Peter

Reply
  • Hello Everyone,

    Thank you for taking the time to look at my issue. I created a .H file to add the structures which are not being located. When the .R file is compiled there is an error:

    {DTYPE_ENDSTRUCT,     1,            ,               DTYPE_LONG},

    TestIssue.r(23) : error: expected expression.

     

    I tried to create a test case:

    TestIssue.mke

    #--------------------------------------------------------------------------------------
    #     $Source:  $
    #
    #  $Copyright:  $
    #--------------------------------------------------------------------------------------
    #---------------------------------------------
    # Define macros specific to this example
    #---------------------------------------------
    PolicyFile = $(MDLMKI)MicroStationPolicy.mki
    
    appName = TestIssue
    
    baseDir         = $(_MakeFilePath)
    
    MDLMKI = $(MSMDE)mki/
    MDLINC = ${MSMDE}include/
    
    %include $(MDLMKI)mdl.mki
    #rCompOpts + -i$(MDLINC)
    cIncs + -I$(MDLINC)
    
    mdlLibs = $(MSMDE)library/
    
    #------------------------------------------------------------------------
    # Create & compile the app's type resource using rsctype & rcomp
    #------------------------------------------------------------------------
    $(baseDir)$(appName).r      : $(baseDir)$(appName).mt   
    
    $(baseDir)$(appName).rsc    : $(baseDir)$(appName).r
    
    

    TestIssue.mt

    #include <RmgrTools\Tools\datadef.r.h>
    
    #include    "TestIssue.h"     /*  */
    
    #pragma packedLittleEndianData
    
    createDataDef(ncitemlinkdata,        DSI_NCITEM_LINKAGE);
    

    TestIssue.h

    #include <RmgrTools\Tools\datadef.r.h>
    #include "Ustn_structures.h"
    #if !defined (resource)
    
    #define  DSI_NCITEM_LINKAGE         20
    
    typedef struct dsiheaderdata
    {
       UChar    appType;     // application element Type (max 256)
       UChar    subType;     // application sub class (max 256)
       UShort   elVersion;   // element version changes ONLY if/when this
    } DSIDataHeader;         // appType and subType's Data sturcture changes
    
    typedef struct userDataHeader
    {
       LinkageHeader    linkHdr;
       DSIDataHeader    dsiHdr;
    } UserDataHeader;
    
    typedef struct ncitemdata
    {
    #if defined (dsiRsc)
       short    buff[12];    // 24 total bytes for largest union member
    #else
       union {
          struct {
             int    isManualOrigin;
             int    originPanelType;
          } origin;
          char   panelId[8];
          char   dscrStr[21];
          char   buff[24];
       } u;
    #endif
    } NCItemData;
    
    typedef struct ncitemlinkdata
    {
       UserDataHeader    userHdr;
       NCItemData        ncData;
    } NCItemLinkData;
    
    #endif
    

    Ustn_Structures.h

     

    /*----------------------------------------------------------------------+
    |                                                                       |
    |   Linkage Header - Same for all element user data                     |
    |                                                                       |
    |   Use LinkageUtil::GetWords/setWords to get/set linkage size.           |
    |                                                                       |
    +----------------------------------------------------------------------*/
    struct LinkageHeader
    {
        UInt16      wdMantissa:8;           // mantissa words: wtf if wdExponent=0 
        UInt16      wdExponent:4;           // exponent for words multiplier       
        UInt16      user:1;                 // boolean: user data linkage          
        UInt16      modified:1;             // boolean: user linkage modified      
        UInt16      remote:1;               // boolean: remote linkage             
        UInt16      info:1;                 // boolean: informational linkage      
        UInt16      primaryID;              // User ID number                      
    };
    
    

    The test case creates a.R file and then tries to compile to a .RSC and there is an error because a field is empty.

    Any suggestions?

    Thanks

    Peter

Children