Home Articles Books Download FAQs Tips

General IDE: Keep an eye on your project's directory settings

When you place a control on a form, the C++Builder IDE automatically checks the project's directory settings for include and lib files. If the paths for the new control are not found, C++Builder adds them to the list for you. This is a nice feature, otherwise, you would have to keep track of your directories manually.

A problem crops up when you remove a control from a form. The IDE does not attempt to remove the directory paths for that control. To see what I mean, create a new project and display the Project Manager. Bring up the project settings and look at the Directories/Conditionals tab. You should see something along these lines:

Include Path:   $(BCB)\include;$(BCB)\include\vcl
Library Path:   $(BCB)\lib\obj;$(BCB)\lib

Now add a third party control to the main form. You can also add one of the sample controls that come with C++Builder if you're still using BCB 1.0. Now compile the project to make the project settings final. Take a look at your Directories/Conditionals settings again. On my system, I see this when I add the Pie chart sample component:

Include Path:   $(BCB)\examples\controls;$(BCB)\include;$(BCB)\include\vcl
Library Path:   $(BCB)\examples\controls;$(BCB)\lib\obj;$(BCB)\lib

Now remove the third party control or sample control, and compile again. Check your Directories/Conditionals settings. You should see that the paths for the control are still listed, even though you removed the control.

For this reason, you should regularly police and cleanup the Directories/Conditionals settings for directories that are no longer used by the project. A good time to do this is during your final pre-release testing. It's also a good idea to peruse your code for extraneous #pragma link commands in your source code. For example, when I removed the pie control from my project, the main unit still had a #pragma statement that was linking in the OBJ for the sample controls, even though I wasn't using the sample controls anymore. This lengthens the linking stage, and has the potential to bloat the EXE. For more details, see the tip on cleaning up #pragma link commands.



Copyright © 1997-2000 by Harold Howe.
All rights reserved.