In the last 40 years there have been many changes in hardware and software. Improvements and changes are almost constant with very short iteration times and this can affect a lot of things in your applications. C++ Builder is generally friendly with old project files XE versions, RADS 10.x.x versions, and RADS 11. We can still use older C++ projects with little or no work. One of the great strengths of RAD-Studio is the ease with which you can modernize very old applications and bring them right up to date to incorporate the very latest technologies, techniques, and advances.
In this post, you’ll get answers to these questions:
- What is Project file in C++ Builder?
- What is .bpr file?
- Can I open very old C++ builder *.bpr project files with the latest RAD Studio?
- Is it possible to use forms of .bpr projects with the latest RAD Studio?
- How can I use forms of old .bpr project?
By learning how to open C++ Builder .bpr Projects with the latest RAD Studio, it will help you to easily build C++ applications using the C++ IDE.
What is a project file in C++ Builder?
A C++ Builder Project (*.cbproj) contains all of C++ files needed in addition to project specific options i.e compiler, compiler options, linker options, project specific paths and libs, deployment options, icons, splash screen of the project. C++ Builder uses *.cpp, *.h, *.hpp files and libs etc. You can create very simple .cpp text-only console programs or you can create very professional and powerful graphical user interface designs. In C++ Builder, there are units that holds designs of window forms of your applications. Formerly C++ Builder project files were *.mak and *.bpr files, now
C++ Builder (*.cbproj) and Delphi (*.dproj) and project files created by the IDE. Each project file contains the current settings for project options, such as compiler and linker settings, directories, conditional directives, and command-line parameters. We can set these options using the Project Options Dialog Box which has tabs for various aspects of your project such as forms, application, and compiler. These project options are stored in the project file with the project. We can use Project > Options to open the Project Options Dialog Box.
Project files are not used when compiling a project from the command line using the command line compiler. When compiled, a project file produces .exe, .dll or .ocx files.
What is a .bpr File?
The *.bpr filename suffix is mostly used for Borland C++Builder Project Format files. The Borland C++Builder Project Format specification was created by Embarcadero Technologies. BPR file format is compatible with software that can be installed on Windows system platform. BPR file format, belongs to the Developer Files category. The software recommended for managing BPR files is C++ Builder. C++ Builder software was developed by Embarcadero Technologies, Inc., and on its official website you may find more information about BPR files or the C++ Builder software program.
A .BPR file is an old project file, a development project file used by compilers and software development IDEs; stores instructions that specify how source files are compiled and linked. If you have a C++ Builder project with a .mak file probably it is a very old project, about from 2000’s. Early versions of C++ Builder were using .mak, .bpr files as a project file that contains, application project settings, other cpp and header file information’s. RAD Studio, C++ Builder XE versions, 10.x.x version and 11 version doesn’t support .mak or .bpr files directly. There is a possibility to run these applications.
How do I use units of legacy .bpr projects?
Now let’s see how we can use units of a .bpr file.
First, we should say that it is not possible to guarantee that we can easily adopt all .mak projects. There have been many changes over the years and some of them are incompatible with one another and difficult to automate. The first thing is this project check to see if the old project is using a 3rd party component. If there is a component, be sure that is compiled and installed to the latest IDE. Some 3rd party components may only support old versions. You can try to compile old component but it may have errors or incompatibility problems with the latest RAD Studio.
If everything is fine we can open and modernize some .mak projects to the latest version. Here is the way,
1. First, .bpr files are Windows applications, so we should use select the new VCL project menu option. Create a new blank VCL Project.
2. Probably first unit of the bpr. project may have Unit1, Form1 definitions, to avoid these conflicts we should delete the current unit. There is a “Remove file from project”,
use this and remove the Unit1 from the project.
3. Now we can try to add the old form of the project
4. There should be .cpp files, select the first unit ( a unit file can be the main unit, generally Unit1.cpp), add to project: If there is no error message that means this form is successfully added to our new modern project . We can see that by pressing this icon as below,
Select the unit to see the design, if everything is all right you will see the form design in this *.mak project. For example I had an example from 2000, maybe even as far back as 1998 and after 20+ years we are able to open this project as below.
As you see there might be some visual problems, i.e here Start button is partially obscured by being off the page. You can arrange your components, you can modernize them, you can add the latest Styles of RAD Studio, you can modify your .cpp code etc. Now you can add other units.
5. Press F9 to compile and Run, there might be errors, probably wrong about paths, set them to correct ones.
In the latest RAD Studio VCL is chosen as the main framework. Thus, here we will remove “vcl\” parts from the ‘include’ paths. For example change line to #include < Classes.hpp>
and so on.
6. Compile, if there are errors try to fix them in accordance with the latest changes..
7. Now we should arrange auto creation of forms, go to Tools->Project Options menu and navigate to Application->Forms. Move main form and other forms to Auto-create forms section and choose the main form of the application.
8. Finally we can change default font and size of the form, components and also we can add Style from Tools->Project Options menu and navigate to Application->Appearance. We want the ‘Carbon’ visual style for our app – so we set the Default Style to Carbon which results in our form looking great and adopting a very modern look and feel which is right up to date!
In this example there was no code changes, all lines were okay – obviously your mileage may vary. Our app was running better than previous version in 2000’s thanks to improvements in the compiler, linker and runtime libraries.
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.
There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.