Step 3b - Resolve Macro DefinitionsConditional compilation, using #ifdef style preprocessor directives in combination with macro definitions and undefines, enables the same base set of source code to be built into a family of executables. When this approach is taken, the macro definitions and undefines are typically generated by passing -D (define) and -U (undefine) options as part of the compiler command line. These options are specified in makefiles or IDEs. When loading source code into a project, the Imagix 4D source analyzer does a full semantic analysis following the same #ifdef style directives. Therefore, it is important that the -D and -U flags normally passed to the compiler for conditional compilation also be specified in the Imagix 4D project settings. If these aren't specified, a number of issues could ensue - ranging from simply including the wrong code into the project to omitting or incorrectly using important symbol definitions during the analysis. Issues of this latter type normally result in the source analysis generating warning and error messages.
Consider the following scenario. In the Analyzer Results window, you might see an analyzer warning about an unknown symbol.
If problems of this type occur in generating your Imagix 4D project, the steps that you take to review and correct your project settings will vary, depending on the approach you're using for loading in your code.
Dialog Based ApproachWith the Dialog Based Approach, the -D and -U options are all manually defined, in the PP Flags field of the Source Files tab of the Project > Data Sources dialog. If you are not already familiar with the -D and -U options used to compile the code, you can review the makefiles or the IDE settings used to build your software, and attempt to locate the -D and -U options that are specified there. Finding a list of the required options is much easier than individually identifying and resolving each specific option. Once you have specified as many -D and -U options as you can by checking makelogs, IDEs and knowledgable collegues, you can follow the scenario above to identify additional options. You can incorporate your findings by manually add these -D and -U flags into the PP Flags field on the Source Files tab on the Project > Data Sources dialog.
Extract from MakelogIn the Extract from Makelog approach, macro definition settings are generated from -D and -U flags in the logfile, according to the makelog processing rules that you have set. If it appears that macro definitions are missing, first select the Extract from Makelog data source on the Project > Data Sources dialog. This will be the first data source listed on the left of the dialog. Review the settings you have made in the Processing Rules tab of the dialog. If you're confident that those are correct, you can manually add any necessary -D and -U options. Switch to the Makelog tab, and enter the required -Dmacro or -Umacro into the Options entry field. Then click the Process Makelog button. The -D and -U options that you entered will be propogated to all of the individual Dialog Based (C/C++) data sources that are created.
Microsoft Visual Studio-BasedUnder the Microsoft Visual Studio-Based approach, macro definition settings are generated automatically from Visual Studio's .sln and .vcproj project files. First make sure that you have the Visual Studio settings and the Configuration correctly set on the Project or Solution tab of the Project > Data Sources dialog. If that doesn't resolve the macro definitions, add any required -D and -U options into the tab's Options entry field. These will supplement those extracted from the Visual Studio project files.