c++builderc++builder-5

How to add a cpp file to an existing project in Borland C++Builder 5?


Adding the line #include "newProc.h" to unit1.cpp and unit1.h is not enough. It leads to an error:

[Linker Error] Unresolved external 'newProcClass::newProc()' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER5\PROJECTS\TEST1\UNIT1.OBJ

(newProc.cpp was not compiled)

Make or Build Project1 with unit1.cpp's line #pragma link "newProc" (obj) is ok, but I want to compile the newProc.cpp in each Make or Build process.


Solution

  • Borland C++Builder 5 is very old - but I am pretty sure it still has a project view which shows the files used by the project. Right click on the project and select "Add..." and then navigate to the .cpp file you want to add.

    If you use the main menu: File | New, and then select either VCL Form or C++ unit (the latter if you are going to develop a C++ file with no VCL GUI, can still use VCL helper functions and classes), then the file is automatically added to the project, and you don't have to do the above procedure.