Imagix 4D User Guide


Load in Your Code - Dialog-Based Approach (C/C++)

5a. specify that you're adding a new data source
Open the Data Sources dialog (MENU Project > Data Sources). To specify that you wish to add a new data source into the project rather than modify the settings for an existing data source, choose `+ new data source' under the Data Sources selector on the left side of the dialog. As this is a new project, and there are no existing data sources to modify, this is indeed the only choice available.

5b. select the dialog-based approach
For the rest of step 5, you'll be working on the right side of the Data Sources dialog. At the tope, select [Source Files][Dialog Based (C/C++)] in the menubutton labeled `Select Data Source Type'.

5c. specify which source files you want to analyze
In the Source Files tab, use the Directory field to enter the name of the directory where your source code is located.

Note: If your source code spans several directories, you may be able to take advantage of the `Analyze files in subdirectories' just below the Directory field. If the code you want to analyze is spread across a directory and its subdirectories (and their subdirectories), enter the name of the top-level directory in this Directory field. If there are certain subdirectories that you want to omit, specify them through the Exclude dialog. Depending on how your source code is spread across your directory structure, you may need to repeat step 5 for each directory containing code you want to analyze.

In the Source Files field, enter the names of the source files. Patterns with * characters are expanded, for example `*.c' expands to a list of all the .c files in the directory. You may enter multiple names and/or patterns, separating them with spaces. You don't need to specify the .h files. The analyzer will automatically analyze any .h file that is included by one of the .c or .cpp files you specify. If you want to add files of multiple suffixes, separate the names with spaces, such as `*.c *.cpp'

5d. specify the -D and -U flags to use in analyzing your source code
Still on the Source Files tab, in the PP Flags field, enter `-Dmacroname -Umacroname' as appropriate. You may enter as many -D and -U's as you wish. Do not put a space between the -D or -U and the following name. Put a space between the name and the next -D or -U.

The -D and -U flags cause macros to be defined or undefined. If you're defining a macro replacement value for a macro name, such as -Dmacroname=value, do not put a space on either side of the = sign.

5e. specify your normal compilation environment
Still on the Source Files tab, specify what compiler you use and what platform you build for. If your combination of compiler and target is listed in the `Compiler & Target' combobox, select it. If there is not one yet, review step 3a, and strongly consider creating an appropriate compiler configuration file. The alternative is to select `other'. If you select `other', you'll need to specify the implicit flags in the PP Flags field (step 5d).

5f. specify the locations of the header files you wish to include
As noted in 5c., normally you don't explicitly direct Imagix 4D to analyze header files. Instead, you rely on the #include statements in the source code, and simply specify which include directories to search for the included header files. This is specified in the Include Dirs tab.

The Include Dirs tab gives you two ways to specify these directories. You can use either of these methods, or both together. If your header files are spread across a directory and its subdirectories (and their subdirectories), you'll probably want to use the `Specify Include Directories By Root Directory' portion of the tab. Enter the name of the top-level include directory in this Directory field, and complete the `Search subdirectories for header files' and the `Exclude' dialog as appropriate.

If your header files are spread across scattered include directories, or if you want control over the order that the include directories are searched, use the `Specify Include Directories Individually' field, to enter `-Idirname1 -Idirname2' as appropriate. You may enter as many -I's as you wish. Do not put a space between the -I and the directory name. Put a space between the directory name and the next -I. If you're running under Windows, and the directory name contains a space, enclose the -Idirname with double quotation marks, such as "-Ic:/program files/msvc/include".

The -I flags tell the analyzer which directories to search for include files. They are searched in the order that you list them. Path names relative to the Directory field on the Source Files tab are supported, such as `-I../parallel/example'.

5g. start the analysis process
At this point you're ready to invoke the analyzer. However, analyzing your code often turns up errors in your settings, particularly how you have specified you include directories and your -D flags. You may find it preferable to load just a subset of your code first. If so, go to the Files field on the Source Files tab, and specify just one particular file to analyze in the first pass.

When you're ready to analyze your code, click Add Data Source at the bottom of the dialog.