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.
Hi Kalyan,
Kalyan Kamepalli said: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:
Kalyan Kamepalli said: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.
Kalyan Kamepalli said: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
Kalyan Kamepalli said: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.
Kalyan Kamepalli said: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
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
this is how my mke file is defined. sew_cmd.h is defined as a dependency file. Is that a problem ?
Jan Šlegr said: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
Kalyan Kamepalli said: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.
Kalyan Kamepalli said:sew_cmd.h is defined as a dependency file
When it is used in source code, it should be defined as dependency file.
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:
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.