Command Table Header file generation

Hello everyone, 

I have an MDL application that needs a rebuild with minor code changes. I have done the changes and have problem building the application. Once of the command table header files is missing from the source code and it is referenced by 40 - 50 other cpp files and that is what is causing the build failures. I thought this header file is something we define and a missing file is a problem for the project but was looking at some of the posts here and the wiki says this is something that is generated by resource compiler from the command table resource table (.r). 

If that is the case, why does the build process complain missing header file ? Is it something related to the order of the process in the .mke file ? How about commenting all the header file reference in those cpp files and build and if successful, bring them back and rebuild again ? Or is there a way I can just generate the header file from resource file  without building the entire application ?

appreciate your time and help here. 

Parents
  • Hi Kalyan,

    I thought this header file is something we define and a missing file is a problem for the project but was looking at some of the posts here and the wiki says this is something that is generated by resource compiler from the command table resource table (.r). 

    Yes, exactly. Command table definition in .r file has to be processed twice during the building process:

    • From .r structure, header file .h with command ids is generated. This file has to be included when the command id(s) is required.
    • .r file is compiled into .rsc and (typically) linked with other resources to .ma file.
    If that is the case, why does the build process complain missing header file ?

    Without knowing your project and how mke (and mki if used) is written, it's hard to say.

    You have to check project mke / mki files how .h file from .r file is defined.

    Is it something related to the order of the process in the .mke file ?

    Of course .h file has to be generated before other files are processed. Often the rule how command ids header file is generated is the first rule from "what files should be compiled" definitions. It can look like similarly to:

    $(genSrc)basiccmd.h	: $(BaseDir)basiccmd.r

    How about commenting all the header file reference in those cpp files and build and if successful, bring them back and rebuild again ?

    It's wrong idea.

    Or is there a way I can just generate the header file from resource file  without building the entire application ?

    Yes, whatever bmake does, you can do also manually. It's nothing else than using compilers (rcomp.exe etc.) from command line. But it's also wrong idea, because correctly written mke/mki files have to do it for you.

    Regards,

      Jan

  • Hi Jan, 

    this is how my mke file is defined. sew_cmd.h is defined as a dependency file. Is that a problem ?

    You have to check project mke / mki files how .h file from .r file is defined.

    #---------------------------------------------
    # MDL Include file dependencies
    #---------------------------------------------
    #
    dbIncl = $(includeDir)sewernet.h \
    $(includeDir)dbdefine.h \
    $(includeDir)dbhdr.h \
    $(includeDir)dbtyp.h \
    $(includeDir)sewelems.h

    rscIncl = $(includeDir)sew_typ.h \
    $(includeDir)sew_ids.h \
    $(dbIncl)

    cmdIncl = $(includeDir)sew_cmd.h


    #---------------------------------------------
    # MDL Resource files
    #---------------------------------------------
    #
    sewRscs = $(objectDir)sew_cmd.rsc \
    $(objectDir)sew_typ.rsc \
    $(objectDir)sew_msg.rsc \
    $(objectDir)sew_dlg.rsc \
    $(objectDir)sew_pal.rsc \
    $(objectDir)sewmesdb.rsc \
    $(objectDir)sewfault.rsc \
    $(objectDir)sew_link.rsc \
    $(objectDir)sew_dll.rsc

    #---------------------------------------------
    # Generate Dll start point
    #---------------------------------------------
    #
    $(objectDir)sew_dll.rsc : $(resourceDir)sew_dll.r

    #---------------------------------------------
    # Generate Command Tables
    #---------------------------------------------
    #
    $(includeDir)Sew_cmd.h : $(resourceDir)sew_cmd.r $(ResourceDir)sew_msg.r

    $(objectDir)sew_cmd.rsc : $(resourceDir)sew_cmd.r $(ResourceDir)sew_msg.r


    #---------------------------------------------
    # Merge Objects into one file
    #---------------------------------------------
    #
    $(applicDir)Sewernet.ma : $(sewRscs)
    $(msg)
    >$(objectDir)temp.cmd
    -o$@
    $(sewRscs)
    <
    $(RLibCmd) @$(objectDir)temp.cmd
    ~time

  • this is how my mke file is defined.

    Please! Follow the best practices and always use Insert > Insert code tool every time you share any code snippet. To read code posted as plain text is confusing.

    sew_cmd.h is defined as a dependency file

    When it is used in source code, it should be defined as dependency file.

    this is how my mke file is defined.

    I assume it's not complete file, because I do not see e.g. how source code file (.mc / .c  /.cpp) are compiled. Also, some standard declarations, typically used in mke files (e.g. in SDK examples) are not there, plus I am not sure why such header file dependency is defined. But it's about personal preferences.

    Because header file is generated using this rule

    $(includeDir)Sew_cmd.h : $(resourceDir)sew_cmd.r $(ResourceDir)sew_msg.r

    did you check whether:

    • It's really created in $(includeDir)?
      BTW The command ids header file is not usually created in "include dir", but in objects folder, because it's treated as "compilation runtime object", nothing that should be stored (e.g. in Git) with other source files.
    • Folders, used to search for header files, are configured properly?

    Also, did you start bmake in verbose mode and analyze output log file? Be aware that also individual compilers (like rcomp.exe) can be started in verbose mode to obtain more detail output.

    Regards,

      Jan

Reply
  • this is how my mke file is defined.

    Please! Follow the best practices and always use Insert > Insert code tool every time you share any code snippet. To read code posted as plain text is confusing.

    sew_cmd.h is defined as a dependency file

    When it is used in source code, it should be defined as dependency file.

    this is how my mke file is defined.

    I assume it's not complete file, because I do not see e.g. how source code file (.mc / .c  /.cpp) are compiled. Also, some standard declarations, typically used in mke files (e.g. in SDK examples) are not there, plus I am not sure why such header file dependency is defined. But it's about personal preferences.

    Because header file is generated using this rule

    $(includeDir)Sew_cmd.h : $(resourceDir)sew_cmd.r $(ResourceDir)sew_msg.r

    did you check whether:

    • It's really created in $(includeDir)?
      BTW The command ids header file is not usually created in "include dir", but in objects folder, because it's treated as "compilation runtime object", nothing that should be stored (e.g. in Git) with other source files.
    • Folders, used to search for header files, are configured properly?

    Also, did you start bmake in verbose mode and analyze output log file? Be aware that also individual compilers (like rcomp.exe) can be started in verbose mode to obtain more detail output.

    Regards,

      Jan

Children
No Data