compile error trying to convert MDL to CONNECT

I installed VS2019, CONNECT and its SDK and I can compile the examples without a problem..

I am trying convert an MDL from SS3 to CONNECT. It is already in .DLL form and compiles within VS in SS3.

When the compiler gets to the type resource, I get this error:

[== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplcmd.rsc, (D:\fpl\devStudio\fplmdl\src\fplcmd.r) ==]
rcomp @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
MicroStation Resource Compiler 10.16.01
BMAKE: no rules to build D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fpltyp.r
BMAKE: call trace
line: 69, D:\fpl\devStudio\fplmdl\src\fplmdl.mke
Mon Apr 04 15:30:20 2022, elapsed time: 0:00

My make file looks virtually identical to the myapp.mke example that compiles without error. Does anybody have any idea what could be going wrong here?

#------------------------------------------------------------------------
# Generate command table include & resource file using rcomp
#------------------------------------------------------------------------
$(o)fplcmd.h : $(baseDir)fplcmd.r

$(o)fplcmd.rsc : $(baseDir)fplcmd.r

#------------------------------------------------------------------------
# Create & compile the app's type resource using rsctype & rcomp
#------------------------------------------------------------------------
$(o)fpltyp.r : $(baseDir)$fpltyp.mt \
$(privateInc)fplids.h

$(o)fpltyp.rsc : $(o)fpltyp.r

#------------------------------------------------
# Set up to use dlmcomp.mki and dlmlink.mki
#------------------------------------------------

Parents
  • $(o)fpltyp.r : $(baseDir)$fpltyp.mt \
    $(privateInc)fplids.h $(o)fpltyp.rsc : $(o)fpltyp.r

    make files are sensitive to white space and line feeds. Try this...

    $(o)fpltyp.r : $(baseDir)$fpltyp.mt  $(privateInc)fplids.h
    
    $(o)fpltyp.rsc : $(o)fpltyp.r

     
    Regards, Jon Summers
    LA Solutions

  • I had to copy over myapp.mke to get passed this error. Now here is the next one...

    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdltyp.r, (D:\fpl\devStudio\fplmdl\src\fplmdl.h) ==]
    rsctype @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Type Resource File Generator 10.16.01
    C:\MDLC\include\Mstn\MdlApi\mselems.h(11) : error: can't open #include file math.h
    C:\MDLC\include\Mstn\MdlApi\mselems.h(11) : error: No such file or directory
    C:\MDLC\include\Bentley/Bentley.h(46) : error: "This file is for C++ compilands only"
    C:\MDLC\include\Bentley/suppress_warnings.h(11) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(12) : warning: pragma not recognized.

    Thanks for your help. 

    Ken

  • Hi ,

    From the developer shell, navigate to the folder where your make file is. Type: build verbose. Then review (long sequential file - from bottom up works best) and/or Zip and Attach it so we can get a better idea of what type of problem is being encountered.

    If you need more insight into how file extensions rules and dependencies are processed within the make file system (.mki files) this search can help provide those entry points:

    findstr -snipr "\.[a-z]*\.[a-z].*:$" "%SDKMKI%*.mki"

    Thank you,
    Bob



  • Comparing to myapp, I see only .r.h files in the header file. Is that a requirement?

    Bentley Systems have a convention of specifying .r.h as the extension for header files that are safe to include in a resource file.  To put that another way, it may not be safe to include a .h file in a resource file. 

    If you look at mselems.h you can see that there's not a lot in it except a few #includes.

    Why do you need that header in your type resource?  What is in fplids.h?

     
    Regards, Jon Summers
    LA Solutions

  • Hi ,

    The build log starting at line 1840 indicates it is encountering an include of math.h (C/C++ header) in the resource file generation portion of the build process. I suggest:

    1. Rename your .r files to .r.h.
    2. Update other source code module references with the above
    3. Take a close look in (previous) .r files for include files, compare to some delivered examples for what you may need to include - or - comment out any C/C++ headers then use SD SearchTerm (search for definitions) to locate the correct header(s) to include.
    4. Recompile until any .r.h/.r C++ compiland errors no longer are present

    Target: D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdltyp.r
    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdltyp.r, (D:\fpl\devStudio\fplmdl\src\fplmdl.h) ==]
    rsctype @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Type Resource File Generator 10.16.01
    C:\MDLC\include\Mstn\MdlApi\mselems.h(11) : error: can't open #include file math.h
    C:\MDLC\include\Mstn\MdlApi\mselems.h(11) : error: No such file or directory
    C:\MDLC\include\Bentley/Bentley.h(46) : error: "This file is for C++ compilands only"

    Bob  



  • Please post the contents of your file fplids.h.

     
    Regards, Jon Summers
    LA Solutions

    Answer Verified By: Ken Adams 

  • I think the only reason I need mselems.h is I refer to these 2 variables:

    MAX_CELLNAME_LENGTH

    LinkageHeader

  • #if !defined (__fplmdlH____)
    #define __fplmdlH__
    
    #include <Mstn\MdlApi\mselems.h>
    
    /*----------------------------------------------------------------------+
    |   Local Defines
    +----------------------------------------------------------------------*/
    #define DCARTES                                 "DCARTES"
    #define IPLOT_EXIT                             -2130575360
    
    #define FPL_TERMINATOR_NAME                    "TERM"
    #define FPL_TERMINATOR_LIB                     "elemp.cel"
    #define FPL_TEMP_WP_MARKER                     "C:\\temp\\wpconvert.txt"
    #define FPL_TASK_ID                            "fplmdl"
    #define TEMP_NEWCEL_LIB                        "c:\\temp\\new.cel"
    
    #define AXIOM_TEMP_FIXER_FILE                  "fixerdgn"
    
    #define AIMSTP_CELLNAME                        "AIMSTP"
    #define AIMSTP_CELL_LIB                        "stamp.cel"
    #define AIMSTP_OFF_SWITCH_CFGVAR               "FPL_NO_AIM_STAMP"
    
    #define AIMSTP_CELLHDR_FIELD                   "AIM DATE STAMP"
    #define AIMSTP_STATUS_FIELD                    "APPROVED PRELIM FIELD"
    #define AIMSTP_DATE_FIELD                      "CHECK IN DATE"
    #define AIMSTP_REVISION_LBL_FIELD              "REVISION LABAL"
    #define AIMSTP_REVISION_NUM_FIELD              "REVISION NUMBER"
    #define AIMSTP_ENGINEERS_NAME_FIELD            "ENGINEERS NAME"
    
    #define AIMSTP_STATUS_STR                      "PRELIMINARY"
    #define AIMSTP_DATE_STR                        " "
    #define AIMSTP_REVISION_LBL_STR                "REVISION"
    #define AIMSTP_REVISION_NUM_STR                "   "
    #define AIMSTP_ENGINEER_NAME_STR               "               "
    
    #define LEFT_JUSTIFIED                                255
    #define RIGHT_JUSTIFIED                                 1
    #define VIEW_WINDOW_1                                   0
    
    #define ICONCMDID_place_fplterm                         1
    #define ICONCMDID_place_fplline                         2
    #define ICONCMDID_move_stamp                            3
    
    #define PULLDOWNMENUID_fpl                              1
    
    #define TEXTID_ActiveTerm                               1
    #define TEXTID_FPLLength                                2
    #define TEXTID_FPLAngle                                 3
    #define TEXTID_StampAngle                               4
    
    #define MLTEXTID_rasterWarning                          1
    
    #define HOOKID_unload                                   1
    #define HOOKID_multi_asize                              2
    #define HOOKID_terminator                               3
    #define HOOKID_length                                   4
    #define HOOKID_angle                                    5
    #define HOOKID_toggleLength                             6
    #define HOOKID_toggleAngle                              7
    
    #define MESSAGELISTID_command                           0
    #define MESSAGELISTID_prompt                            1
    #define MESSAGELISTID_errors                            2
    #define MESSAGELISTID_misc                              3
    #define MESSAGELISTID_mdlApps                           4
    
    #define DIALOGID_termParams                             1
    #define DIALOGID_rasterWarning                          2
    #define DIALOGID_engNameWarning                         3
    
    #define TOGGLEID_placeDot                               1
    #define TOGGLEID_Length                                 2
    #define TOGGLEID_Angle                                  3
    
    #define FPL_LMSK0_REF_BDR_LEVEL                       256     /* level 9 */
    #define FPL_LMSK03_CHECKIN_DATESTAMP_LEVEL           8192;    /* level 62 */
    
    #define CMDID_PlLine                                    1
    #define CMDID_PlTerm                                    2
    #define CMDID_PlStamp                                   3
    
    #define PRMTID_enterFrstPnt                             1
    #define PRMTID_enterEndPnt                              2
    #define PRMTID_identifyElm                              3
    #define PRMTID_placeStamp                               4
    
    #define ERRID_cannotLoadCmdTbl                          1
    #define ERRID_termNotDefined                            2
    #define ERRID_cannotGetDotCell                          3
    #define ERRID_badDgnFileHdr                             4
    #define ERRID_multiRastersFnd                           5
    #define ERRID_badRasterName                             6
    #define ERRID_copyFailed                                7
    #define ERRID_cantAttachAimStampLib                     8
    #define ERRID_bdrRefNotAimCompliant                     9
    #define ERRID_cantOpenMDL                              10
    #define ERRID_timerFuncFailed                          11
    #define ERRID_cantGetRscCfgVar                         12
    #define ERRID_cantLoadFplComRsc                        13
    
    #define MISCID_loadRaster                               1
    #define MISCID_loadMDL                                  2
    
    #define MDLID_fplsite                                   0
    #define MDLID_cade                                      1
    #define MDLID_cadeDoc                                   2
    #define MDLID_cd1                                       3
    #define MDLID_autobdr                                   4
    #define MDLID_fplplot                                   5
    #define MDLID_multiview                                 6
    #define MDLID_wireclr                                   7
    #define MDLID_fcg                                       8
    #define MDLID_termblk                                   9
    #define MDLID_zblk                                     10
    #define MDLID_repabs                                   11
    #define MDLID_engrwp                                   12
    #define MDLID_wirewp                                   13
    #define MDLID_txe                                      14
    #define MDLID_rasload                                  15
    #define MDLID_findlib                                  16
    #define MDLID_fixer                                    17
    #define MDLID_office                                   18
    #define MDLID_spell                                    19
    #define MDLID_null                                     20
    
    typedef struct fplvars
    {
    	int     placeDot;
    	int     lengthFlag;
    	int     angleFlag;
    	char    terminator[MAX_CELLNAME_LENGTH];
    	char    length[64];
    	char    angle[64];
    	char    engName[64];
    	char    stampAngle[64];
    } FplVars;
    
    
    typedef struct linkinfo
    {
    	short AppID;
    	short myClass;
    	char dateStamp[80];
    } LinkInfo;
    
    typedef struct linkdata
    {
    	LinkageHeader linkHdr;
    	LinkInfo      linkage;
    } LinkData;
    
    
    typedef struct firstPntDot
    {
    	int             place;
    	DPoint3d        pnt;
    } FirstPntDot;
    
    
    
    

  • btw, I renamed fplids.h to fplmdl.r.h and all references to it. I am still getting the same error:

    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdltyp.r, (D:\fpl\devStudio\fplmdl\src\fplmdltyp.mt) ==]
    rsctype @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Type Resource File Generator 10.16.01
    C:\MDLC\include\Mstn\MdlApi\mselems.h(11) : error: can't open #include file math.h
    C:\MDLC\include\Mstn\MdlApi\mselems.h(11) : error: No such file or directory
    C:\MDLC\include\Bentley/Bentley.h(46) : error: "This file is for C++ compilands only"

  • I think the only reason I need mselems.h is I refer to these 2 variables

    First, they are not variables.  MAX_CELLNAME_LENGTH is a macro treated as a constant. LinkageHeader is a struct that you use in your linkdata struct.

    mselems.h doesn't define those objects.  It includes other headers.  It's best to include the exact headers you want.

    #include <DgnPlatform/DgnPlatform.r.h> // MAX_CELLNAME_LENGTH
    #include <DgnPlatform/DgnFileIO/DgnElements.h> //  LinkageHeader
    I renamed fplids.h to fplmdl.r.h

    Why? Renaming a file achieves nothing.  It's the contents of the file that are important.  File extension .r.h indicates that the author (that's you) deems the contents to be safe for use by the SDK resource compilers.  If you haven't changed the contents of the file, then that's a false indication.

     
    Regards, Jon Summers
    LA Solutions

  • I see that DgnElements.h includes Bentley.h which includes limits.h which is now the incllude file the compiler cannot find. 

    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdlcmd.rsc, (D:\MDL\devStudio\fplmdl\src\fplmdlcmd.r) ==]
    rcomp @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Resource Compiler 10.16.01

    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdltyp.r, (D:\MDL\devStudio\fplmdl\src\fplmdl.r.h) ==]
    rsctype @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Type Resource File Generator 10.16.01
    C:\MDLC\include\Bentley/Bentley.h(46) : error: "This file is for C++ compilands only"
    C:\MDLC\include\Bentley/suppress_warnings.h(11) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(12) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(13) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(14) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(16) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(17) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(18) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(19) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(28) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(33) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(39) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(40) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(41) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(43) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(44) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/Bentley.h(70) : warning: macro ENUM_UNDERLYING_TYPE previously defined as .
    C:\MDLC\include\Bentley/Bentley.h(112) : error: can't open #include file limits.h
    C:\MDLC\include\Bentley/Bentley.h(112) : error: No such file or directory
    C:\MDLC\include\Bentley/Bentley.h(239) : error: Data declarations must be typedefs.
    C:\MDLC\include\Bentley/Bentley.h(239) : error: expected ;, got BENTLEY_NAMESPACE_NAME
    C:\MDLC\include\Bentley/Bentley.h(239) : error: bad declaration
    C:\MDLC\include\Bentley/Bentley.h(239) : error: Data declarations must be typedefs.
    C:\MDLC\include\Bentley/Bentley.h(239) : error: expected ;, got }

Reply
  • I see that DgnElements.h includes Bentley.h which includes limits.h which is now the incllude file the compiler cannot find. 

    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdlcmd.rsc, (D:\MDL\devStudio\fplmdl\src\fplmdlcmd.r) ==]
    rcomp @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Resource Compiler 10.16.01

    [== Building D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\fplmdltyp.r, (D:\MDL\devStudio\fplmdl\src\fplmdl.r.h) ==]
    rsctype @D:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Type Resource File Generator 10.16.01
    C:\MDLC\include\Bentley/Bentley.h(46) : error: "This file is for C++ compilands only"
    C:\MDLC\include\Bentley/suppress_warnings.h(11) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(12) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(13) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(14) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(16) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(17) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(18) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(19) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(28) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(33) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(39) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(40) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(41) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(43) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/suppress_warnings.h(44) : warning: pragma not recognized.
    C:\MDLC\include\Bentley/Bentley.h(70) : warning: macro ENUM_UNDERLYING_TYPE previously defined as .
    C:\MDLC\include\Bentley/Bentley.h(112) : error: can't open #include file limits.h
    C:\MDLC\include\Bentley/Bentley.h(112) : error: No such file or directory
    C:\MDLC\include\Bentley/Bentley.h(239) : error: Data declarations must be typedefs.
    C:\MDLC\include\Bentley/Bentley.h(239) : error: expected ;, got BENTLEY_NAMESPACE_NAME
    C:\MDLC\include\Bentley/Bentley.h(239) : error: bad declaration
    C:\MDLC\include\Bentley/Bentley.h(239) : error: Data declarations must be typedefs.
    C:\MDLC\include\Bentley/Bentley.h(239) : error: expected ;, got }

Children
  • as a test, I added the 2 headers you suggested to the myapp example's header file myapp.h and I got the same error:

    C:\MDLC\include\Bentley/Bentley.h(112) : error: can't open #include file limits.h

    Actually, I cannot find limits.h anywhere in the include folder.

  • The problem is that you are attempting to build a type resource (.mt) file that uses a C struct LinkageHeader defined in a C++ header.  The Bentley type resource compiler can't cope with all the C++ baggage that comes with #include <DgnPlatform/DgnFileIO/DgnElements.h>.

    The purpose of a type (.mt) file is to be processed by publishStructures that is the only statement in your (.mt) file.  The reason to publish a structure is so that it can be handled by the MicroStation dialog manager when its data is displayed in a dialog box.  Why do you want to display LinkageHeader in a dialog box?

    I suggest that you place structs designated for use in the UI in their own header file, and structs that are not used in the UI in a separate header file to be included by your C++ implementation code.

    In the myapp example, struct DlogBoxInfo uses primitive data types that are understood by both the C++ compiler and by the Bentley type resource compiler.

     
    Regards, Jon Summers
    LA Solutions

  • Thank you Jon. Your suggestion resolved this problem. Keep the publishStructures resource separate.

    Interestingly, I saw this comment in several examples:

    WARNING: Do not mix publishStructures commands with createDataDef

    I could  not find a single example that uses both a UI and user linkages. Since my application does, I added another resource file for the createDataDef and it seemed to compile fine. Does this look like the correct thing to do?

    #------------------------------------------------------------------------
    # Create & compile the app's type resource using rsctype & rcomp
    #------------------------------------------------------------------------
    $(o)$(appName)typ.r : $(baseDir)$(appName)typ.mt $(privateInc)$(appName).r.h

    $(o)$(appName)typ.rsc : $(o)$(appName)typ.r

    $(o)$(appName)link.r : $(baseDir)$(appName)link.mt $(privateInc)$(appName)link.h

    $(o)$(appName)link.rsc : $(o)$(appName)link.r

    I am at least past the resource compilation errors and onto the .cpp errors. That feels like an accomplishment! Thanks again for your help.