c++builder-6c++builder-2010

Whats identifies a 'Unit' in Borland/Embarcadero CBuilder IDE


I have a number of c++ projects were units were added. After working a while on these projects some of these units change into a .cpp file and a .h file with no connection between the two anymore.

When I click the header file in the "project manager", the .cpp file gets focus in the IDE. I have to right click on the .cpp source and choose "open source/header file" to open the header file. Normal behaviour in a unit is a set of tabs below the source window to choose between source and header.

How can I restore this?


Solution

  • The .cpp and .h files need to have the same base name, eg <name>.cpp and <name>.h, for example Unit1.cpp and Unit1.h. And the .h file needs to have a header guard named <name>H, for example Unit1H. Then, the IDE will treat the files (and any associated <name>.dfm file) as a single "unit".