Environment Menu CommandsThe IDDE's Environment menu (Figure 15-1) contains commands with which you can modify the IDDE work environment.
[Figure 15-1 Environment menu commands
A list of available workspaces is added to the end of the Environment menu. The current workspace is checked. Choosing a name in this list is equivalent to clicking on the workspace tab in the Workspace toolbox.
- The Workspace submenu (Figure 15-2) contains commands for
creating and editing workspaces.
[Figure 15-2 Workspace submenu]
- Opens the Workspace Name dialog box.
[Figure 15-3 Workspace Name dialog box]
To create a new empty workspace, type a name for the workspace and click OK. The Build and Views toolboxes open automatically.
The New command is disabled if you already have five workspaces.
- Opens the Workspace Name dialog box. To create a copy of the
current workspace, type a name for the new workspace and click
The Clone command is disabled if you already have five workspaces.
- Deletes the current workspace from the workspace set. The last remaining workspace cannot be deleted.
- Opens the Workspace Name dialog box. Type a new name for the current workspace and click OK.
- Resets the current workspace to the configuration it had when you started the session or when you last saved it during the current session with Save Workspace Set.
- Save Workspace Set
- Saves the current workspace configurations. These configurations can be restored with the Reset command.
- Environment Settings
- This command opens the Environment Settings dialog box with which you specify various environment options. Two pages of options are available: Workspace and Color.
WorkspaceThis page (Figure 15-4) provides options for controlling workspaces.
[Figure 15-4 Workspace page of the Environment Settings dialog box
Save workspace set on exitSaves the workspace set when the IDDE is closed.
Open last project on launchWhen the IDDE is launched, automatically opens the project that was open when the IDDE was last closed.
ColorThis page (Figure 15-5) provides options with which to customize the IDDE windows' colors.
[Figure 15-5 Color page of the Environment Settings dialog box
To change an item's color, first click on the item name. A dashed box appears around the item name. Then click on Change Color. You may then choose a new color from a Windows Color dialog box.
- Editing/Browsing Settings
- Opens the Editing/Browsing Settings dialog box, with which you can view and change the IDDE's editing and browsing options. For more information, see Chapter 19, "Class Editor Reference," Chapter 20, "Hierarchy Editor Reference," and Chapter 21, "Text Editor Reference."
More about ProjectsThis section continues the discussion of projects that began in Chapter 3, "Starting a Project and Defining Workspaces."
What a project containsThe project file contains a list of all the files in your project. It also contains information on how these files depend on one another. When the project manager creates a makefile (a file that builds your program), it uses a file's extension to decide what kind of file it is. The files you can put in a project are described here, along with how the IDDE uses them to build a program.
C and C++ filesThe IDDE compiles C and C++ source files to produce object files and links the object files to produce the target.
C source files have the .c extension; C++ source files have either the .cpp or the. cxx extension. When compiled, they all generate object (.obj) files.
Header filesYou do not need to add header files to a project; they are added automatically by the project system. See the section "Dependency tracking" later in this chapter.
If you do add a header file explicitly, it is flagged automatically for precompilation. See the description of the Header Files page of the Project Settings dialog box in Chapter 16, "More about Project Build Settings."
The header files that are included by C/C++ source files to provide common interface definitions are identified by the file extensions .hpp, .hxx, and .h.
In some situations, a C/C++ source file may be included by another source file. In this case, you probably do not want a separate object file created from that included source file. Do not add the file to the project. When you compile the target, the project system adds the included file but tracks it as an included object that should not be compiled or linked independently.
Assembly filesYour project may contain assembly source and header files. Assembly language source files are identified by the file extension .asm. Assembly language header files are identified by the file extension .inc.
Note: For assembly files to be built as part of a project, MASM must be in a directory specified by the PATH environment variable. For a NetBuild project, MASM must be in a directory specified by the PATH environment variable of every buildserver, and the buildclient.
Object filesYour project can include pre-existing object files- files for which you do not have the source or that were compiled outside the IDDE. Such object files are identified by the file extension .obj. These objects are linked into your executable.
Resource and dialog script filesYour project can include resource script files, dialog script files, and other binary resource files. The IDDE compiles these script files to produce a resource file. After the IDDE links the object files, it binds the resources from the resource files into the executable. The resource file types are:
- Source scripts of resource files that are compiled by the Digital Mars C++ resource compiler
- .ico, .cur, .bmp
- Binary resources
- Compiled binary resources
LibrariesYour project can include libraries. The IDDE links the libraries with the project's object files to produce the executable file. If your program uses a dynamic link library (DLL), don't add the DLL to the project file. Instead, add the DLL's import library (.lib).
Libraries or library interfaces to a DLL that you want to link into your executable are identified by the file extensions .lib.
Linker definition filesYour project can include a linker definition (sometimes called module definition) file. Use a linker definition file to indicate to the linker how to build a library or executable. These files are identified by the file extension .def.
If you have your own .def file, you can include it in the project. The IDDE automatically modifies the .def file to change a linker option if necessary. If you do not specify a .def file, one is generated and maintained automatically for you.
Project filesThe IDDE automatically generates and maintains project files. Project files can be nested to form a hierarchical project structure. Project files are identified by the file extension .prj.
Option setYou can include your own option set. Option sets that you create are identified by the file extension .opn.
Batch and makefilesYou can include a batch or makefile. Batch files are identified by a .bat file extension, and makefiles by a .mak file extension.
When you add a batch file or a makefile to a project, the Build Order dialog box (accessible via the Build Order button on the Make page under the Build tab of the Project Settings dialog box) becomes available to specify when to execute your batch files and makefiles.
Project-generated filesThe project system generates and maintains files with these extensions:
- The project file that contains information on the base directory of the project, the option set, the Version Control System (VCS) configuration location, and each of the files and its attributes.
- The makefile generated from the project options and files. You don't have to write and maintain a makefile- the project system does it for you.
- The linker definition (module definition) file. You can specify your own .def file or let the project system generate and maintain one for you.
- The file that keeps the dependency listing.
- The file in which project options are stored.
- A resource file that directs the linker to build your target. It is generated and maintained by the project system.
Hierarchical project structureYou can include projects within projects (to any depth) to create a hierarchical project structure. Hierarchical projects have many uses.
You can use hierarchical projects if you need to build more than one target as part of a system. For example, if your system includes an executable and a DLL, you can create a separate project for the DLL and include this new subproject in the master project. The library is built automatically when (and if) necessary. (Note that, since Windows relies on the module name to determine the uniqueness of modules, you need to give your targets different names. For example, do not name the executable generated by a project mymod.exe and name a DLL created by a subproject mymod.dll; an error results.)
In other cases, some files may need different compiler settings. You have two options. You can put those files in a separate subproject, setting compile options for the project as necessary. Or, you can override compile options on a file-by-file basis. To do this, right-click on the file in the Project window, and choose Settings from the pop-up menu. You can then set compile options for that file.
If you have a special preprocessing or translation step in your build process, you can create a subproject (a project within another project) for that make step. To accomplish the preprocessing, use the Make page under the Build tab in the Project Settings dialog box (see Chapter 16, "More about Project Build Settings") to call your own makefile or batch file.
Use hierarchical projects to handle different releases or versions of a project. To build all the variants in one simple step, create a master project that contains only projects. When you build the master, each of the variants is built.
These examples show that the hierarchical project system can be used in a variety of ways to customize the build process. Note that dependency tracking still works for subprojects- they are built as needed, before the master project is built.
Note: When you build a project that has a hierarchical structure, all subprojects are rebuilt with either the Debug or Release setting, whichever is applied to the master project. To ensure that each subproject is linked with the correct libraries (Debug or Release), you need to rebuild each subproject's .lnk file.
Dependency trackingThe project system automatically tracks dependencies among the components of a project. Dependency information is updated with each successive compilation. As you add or remove include files, for example, the corresponding dependencies are updated. You have the option of turning this tracking off.
The IDDE also tracks changes made to build options and determines how much of the project needs to be rebuilt based on those changes. For example, if you change a compiler setting, all the sources are rebuilt. If you change a resource compiler option, only the resource compiler and link steps are executed. If you change a link option or library directory, only the linker is run. By tracking these changes, the project system supports efficient and accurate builds.
In the Windows 3.1 version of the IDDE, the project system can track files in the project with respect to version control. For more information on project and source code control, see Chapter 22, "Using Version Control."
Project menu commandsThe IDDE's Project menu (see Figure 15-6) contains commands to create, open, edit, and close projects; to build projects, to run the application; and to set project options. At the end of the menu, the IDDE adds the names of the most recently opened projects so that you can switch between projects as you work.
[Figure 15-6 Project menu commands]
- Opens the ProjectExpress dialog box, as described in Chapter 3, "Starting a Project and Defining Workspaces."
- Opens the Open Project dialog box, as described in Chapter 3, "Starting a Project and Defining Workspaces."
- Opens the Edit Project dialog box, as described in Chapter 3, "Starting a Project and Defining Workspaces."
- Closes the current project.
- Builds your project. The IDDE examines all files in the project to determine whether they are up-to-date and recompiles only the necessary files.
- Stop Build
- Stops a build in progress. You can also stop a build by choosing Stop! from the Output window's menu bar.
- Rebuild All
- Rebuilds all files in your project, regardless of whether they are up-to-date.
- Links all object files and libraries. Use Link instead of Build when adding .lib or .obj files to a project or subtracting them from a project. You can also use this command if you know all files are up-to- date. There is no dependency checking with Link, so linking is faster than building. Also, you would use Link rather than Build if you changed source code but you wanted to generate an .exe with existing .obj files.
- Execute Program
- Executes your application. Command-line arguments may be set with the Arguments command.
- Opens the Run Arguments dialog box (Figure 15-7).
[Figure 15-7 Run Arguments dialog box
Type the command-line arguments that you want passed to an application when you choose Execute Program.
- Opens the Project Settings dialog box. This dialog box lets you set project options that specify how the IDDE builds a project. The following pages are available by clicking on the tabs at the top of the dialog box: Target, Build, Option Sets, VCS, and Directories.
Target settingsThe options on the Target page (Figure 15-8) specify the target and platform for your project.
[Figure 15-8 Target page of the Project Settings dialog box
Operating systemThis set of options determines the target system for your project. Depending on the selection of the target system, different Target Type options become available. The target system can be one of the following:
- Windows 95
- Windows NT
- Windows 3.1
Target typeThis set of options determines what your project will actually be: an executable, a library, a Windows DLL, or a simple console. The target type can be one of the following:
- Builds an executable program (.exe). Dynamic Link Library: Builds a Windows DLL. This option is not available when Operating System is set to DOS or DOSX.
- Static library
- Builds a static library (.lib) -- that is, a library a program links to at compile time- as opposed to DLL, which links at run-time.
- Builds a DOS executable .com file. This option is only available when Operating System is set to DOS.
- Builds a Windows console program. In Windows 3.1 (and Win32s) this creates an SDI application in which the standard input and output functions are carried out through the SDI window. In Windows 95 and Windows NT, this creates an executable that runs as a console application, simulating an old-style teletype.
UsesThese options let you select the extension libraries that are linked to the executable.
- MFC (Microsoft Foundation Class Library)
- Links the libraries needed for an application that uses classes from the MFC. Two methods of linking are available: static library (.lib) or dynamic link library (DLL).
- OLE (Object Linking and Embedding)
- Links the libraries needed for creating an application that uses OLE.
- VBX (Visual BASIC Control)
- Links the libraries needed to create a Visual Basic control.
- OCX (OLE Control)
- Links the libraries for building an OLE control.
- ODBC (Open Database Connectivity)
- Links the libraries needed to access an ODBC data source.
Project settingsTwo options determine whether debugging information is included in the executable.
- The executable contains debugging information and can be debugged by the IDDE debugger.
- The executable contains no debugging information. It cannot be debugged.
Allow project to be builtIf this option is selected, the application can be built. Deselect this option if a project should not be built (for example, if you don't want a subproject rebuilt when you choose Rebuild All in the parent project).
Parse for browsingIf this option is selected, the project is automatically parsed. Deselect if you don't want the Browser to parse the source code. See Chapter 5, "Defining Classes and Their Hierarchies," for more information.
Build settingsThe options on the Build page control how your project is compiled and linked. See Chapter 15, "More about Projects and Workspaces."
Option setsThe Option Sets page (Figure 15-9) lets you save and retrieve project options. This feature makes it easy to define options once for a particular kind of target and apply them later to another project.
[Figure 15-9 Option Sets page of the Project Settings dialog box
When you exit the IDDE or close a project, current options are saved in the project option file (. opn). This file has the same name as the project. For example, if the project name is test. prj, the option set associated with that project is named test. opn.
The list of option sets includes sets you define and several predefined option sets. Click on an option set name to select the option set; double-click on an option set name or click on Load to load the option set.
The predefined option sets are useful starting points for defining your own custom options. When you load one of these option sets, save any changes to another option set so the defaults are intact for later use. These option sets are named according to the target type and whether debugging information is placed in the executable.
The four buttons on the dialog box have the following functions:
- Loads the selected option set.
- Saves the current option set.
- Creates a new option set. You are prompted for the new set's name.
- Opens the Option Set Name dialog box, from which you can select an option set file to load.
VCS optionsThe options on the VCS page control the version control system. These options are only available in the 16-bit IDDE. For information about version control see Chapter 22, "Using Version Control."
DirectoriesThe options on the Directories page (Figure 15-10) specify various directories used by the compiler, linker, and browser.
[Figure 15-10 Directories page of the Project Settings dialog box
Include directoriesSpecifies directories to be searched for included files. You may specify multiple directories by separating each pathname with a semicolon. These directories are searched after those specified by the INCLUDE environment variable.
Library directoriesSpecifies which directories to search for libraries. You may specify multiple directories by separating each pathname with a semicolon. These directories are searched after those specified by the LIB environment variable.
Compiler output directorySpecifies the directory in which object files (.obj) are placed.
Target output directorySpecifies the directory in which the linked target is placed.
Browser exclude directoriesSpecifies the directories that are excluded from parsing by the browser. Use this option, for example, to exclude the MFC header file directory, and thus prevent the display of MFC classes in the Class and Hierarchy editors.
Source search pathSpecifies which directories to search for source files while debugging.
The Project WindowThis section describes all the menu commands available from the Project window.
Parse menu commandsThe Parse menu (Figure 15-11) contains commands to control the parsing of source files. Parse information (information about the project's C++ classes and class members) is stored in a global pool that is accessible to and used by the Class and Hierarchy Editors.
[Figure 15-11 Parse menu commands
- Update All
- Parses all unparsed files in the project.
- Parse All
- Parses all files in the project.
- Parse File
- Parses the selected file, adding information about classes and members in the file to the global parse information.
- Unparse File
- Unparses the selected file. It removes classes and members in the file from the global parse information.
- Stop Parse
- This command cancels a parse operation in progress. You can also stop a parse by choosing Stop! from the Output window's menu bar.
View menu commandsIn debugging mode, commands in the View menu update other IDDE windows to show information pertaining to the selected file. For more information on this menu refer to Chapter 24, "Commands Available in Debugging Mode."
Trace menu commandsThe Trace menu controls whether the debugger can step into, set breakpoints in, or watch data in a particular source file in debugging mode. See Chapter 24, "Commands Available in Debugging Mode," for more information.
VCSThe VCS menu controls the Version Control System operation. Version control options are only available in the 16-bit IDDE. The VCS menu commands and their functions are described in Chapter 22, "Using Version Control."
Project window left pane pop-up menu commandsThis menu (Figure 15-12) contains commands that operate on the current project.
[Figure 15-12 Left pane pop-up menu commands
- New Subproject
- Opens the New Sub-Project dialog box, in which you select a project to be a subproject of the currently selected project.
- Links the project. This is the same as choosing Link from the IDDE's Project menu.
- Builds the project. This is the same as choosing Build from the IDDE's Project menu.
- Rebuild All
- Rebuilds the entire project. This is the same as choosing Rebuild All from the IDDE's Project menu.
- Parses all files. This is the same as choosing Parse All from the Parse menu.
- Edit Project
- Opens the Edit Project dialog box, as described in Chapter 3, "Starting a Project and Defining Workspaces." This is the same as choosing Edit from the IDDE's Project menu.
- Opens the Project Settings dialog box. This is the same as choosing Settings from the IDDE's Project menu.
Project window right pane pop-up menu commandsThis menu (Figure 15-13) contains commands that operate on the selected file.
[Figure 15-13 Right pane pop-up menu commands
- Compiles the selected file.
- Parses the selected file. This is the same as choosing Parse File from the Parse menu.
- Opens the Other submenu, which contains the Preprocess, Disassemble, and Precompile commands.
- Preprocesses the selected file.
- Disassembles the selected file.
- Precompiles the selected file.
- Is the same as choosing Get from the VCS menu.
- Is the same as choosing Put from the VCS menu.
- Removes the selected file from the project. You can also remove a selected file from the project by pressing Delete.
- Sets read/write attributes for the selected file. They are mutually exclusive, so only one can be selected. A checkmark is displayed next to the selected item.
- Read Only
- Sets the attribute to read only.
- Sets the attribute to read/ write.
- Don't Show
- Filters the display of the project's files.
- Does not list modules added by the debugger.
- Does not list files added by the parser.
- Does not list files included through dependency relationships.
- Lets you set certain compiler options for an individual source file, overriding those specified for the project as a whole. Choosing this command opens the Project Settings dialog box with only the Build tab available (see Chapter 16, "More about Project Build Settings"). Only the compiler-related subpages (Compiler, Code Generation, Header Files, Code Optimizations, Output, Warning, and Debug Information) are available. The Inherit from Project button resets this source file's individual options to those of the project.
"..." pop-up menu commandsThis menu (Figure 15-14) is opened by clicking on the "..." box above the vertical scroll bar in the right pane of the Project window.
[Figure 15-14 "..." pop-up menu commands
Use this menu to set up the display of project file information in the right pane. Information that can be displayed includes:
- Displays the filename.
- Displays the file extension.
- Displays the file path.
- Displays the modification date.
- Displays the modification time.
- Displays whether or not the file has been parsed.
- Displays to which EXE or DLL the module belongs (in debugging mode).
- Displays whether the module is virtual (in debugging mode).
Columns of information are removed from the display by dragging the column heading out of the column heading area. (The item then becomes available on the "..." pop-up menu.) The order of the columns can be changed by dragging the column headings to a new position.
Project window mouse functionsUse the mouse to open projects, select project files, open source windows, drag project files to other windows, open pop-up menus, and change the relative sizes of the right and left panes.
To resize the panes, first position the cursor on the dividing line between panes. The cursor changes to a two-headed arrow. Then click the left mouse button and drag the separator to the desired location.
The right mouse button opens the pop-up menus (see the sections "Project window left pane pop-up menu commands" and "Project window right pane pop-up menu commands" earlier in this chapter).
Click on a project or subproject in the left pane to open that project. Double-click on the current project in the left pane to toggle (expand or collapse) the display of its subprojects.
Click on a project file in the right pane to select it. Double-click on a file in the right pane, or drag it to an empty part of the workspace, to open the Source window to view and edit the file. (Double-clicking on a subproject in the right pane opens that subproject.)
You can drag files from the right pane to Source windows, Function windows, Data/ Object windows, and Assembly windows.
Finally, to eliminate a column of information from the right pane, click on the title at the top of the column and drag it outside the column heading area. Columns of information are restored from the "..." pop-up menu, to the right of the column titles. To rearrange columns of information, drag the title at the top of the column to a new position. You can make columns wider or narrower by dragging the column title's right edge to the right or left. Clicking on a column title re-sorts the list of project files according to that column.