Learn C++

How To Open Legacy C++ .mak Files With The Latest RAD Studio

In the last 40 years of there have been many changes in hardware and software. Improvements and changes are carried out in very short time spans and they can quickly affect a lot of things in your older applications. C++ Builder is generally friendly with old XE project files versions, RAD Studio 10.x.x versions, and RAD Studio 11. While changes have happened and things have evolved, we can still use some of the old C++ projects. Thus, you can modernize even very old applications with the latest versions of RAD Studio.

In this post, you’ll learn what a Project file is in C++ software, what a .mak file is, and how to open very old C++ builder *.mak project files with the latest RAD Studio, how to use.mak projects with the latest RAD Studio, and how to use old versions of a.mak project.

What is a Project File in C++ Builder?

C++ Builder uses *.cpp, *.h, *.hpp files and libs etc. You can create very simple text-only .cpp console files or you can create very professional form designs. In C++ Builder, there are specially-formatted units which holds designs of window forms of your applications. A C++ Builder Project (*.cbproj) contains references to all of these 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 and similar.

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 .mak File?

A .mak file is a legacy MakeFile, a development project file used by compilers and software development IDEs; it stores instructions that specify how source files are compiled and linked. If you have a C++ Builder project with a .mak file it is probably a very old project, about from 90’s or from 2000’s. Early versions of C++ Builder were using .mak files as a project file that contains, application project settings, other cpp and header file information. RAD Studio, C++ Builder XE versions upwards including all 10.x.x versions and the 11 Alexandria version doesn’t support .mak files. Despite that there is a possibility to run these applications.

Can I open legacy C++ Builder *.mak project Files with the latest RAD Studio C++ Builder?

The answer is ‘Yes’ but, also, ‘No’.

How To Open Legacy C++ mak Files With The Latest RAD Studio selecting the mak file

The answer is ‘Yes’ because you can open directly *.mak files as a text file as below. RAD Studio will show this file as a text file as shown here:

How To Open Legacy C++ mak Files With The Latest RAD Studio legacy code

As a project however, the answer is ‘No’. We cannot open *.mak files as a project with forms. If the application is using standard components we can create a new project and add these units (forms with .cpp and .h files) to our new project. Thus, it is possible to use forms of .mak projects with the latest RAD Studio versions, including RAD Studio 11.

How do I use units from legacy .mak C++ projects?

Now let’s see how we can use units of a .mak 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. The first thing is this project shouldn’t have used any 3rd party components. If there is a component, be sure that is compiled and installed to the latest IDE. Some 3rd party components may support old versions, or you should try to compile old component which 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, .mak files are Windows applications, so we should use a new VCL project. Create a new blank VCL Project.
2. Probably first unit of the mak. project may have Unit1, Form1 definitions, to avoid these conflicts we should delete the current unit. There is a “Remove file from project”,

How To Open Legacy C++ mak Files With The Latest RAD Studio removing unwanted things from the project

use this and remove the Unit1 from the project.
3. Now we can try to add the old form of the project

How To Open Legacy C++ mak Files With The Latest RAD Studio adding new files to 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,

How To Open Legacy C++ mak Files With The Latest RAD Studio view the form

Select the unit to see the design. If everything is all right your will see the form design in this *.mak project. For example we had a project from 2000, maybe even from 1998, and after 20+ years we are able to open this project as below.

How To Open Legacy C++ mak Files With The Latest RAD Studio old style form open in latest RAD Studio C++ Builder

As you see there might be some visual problems, i.e here Start button is not clear. 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 correct ones.

How To Open Legacy C++ mak Files With The Latest RAD Studio tidying up the include references

In the latest RAD Studio, VCL is chosen as main. Thus, here we will remove “vcl\” parts in these includes, we don’t need them. for example, we can change line to #include < Classes.hpp> and go 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.

How To Open Legacy C++ mak Files With The Latest RAD Studio selecting the main form

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 to use the really cool dark and modern Carbon Style so we set “Default Style” in the project properties “appearance” section to Carbon.

Finally if we run, here is the modernized legacy .mak project from around 22 years ago, now upgraded as a new project with modern styles.

How To Open Legacy C++ mak Files With The Latest RAD Studio the legacy app updated to a new look and feel and ready to go

From this point you may need to improve your application, you can add the latest 3rd party components, libs. In this example there was no code changes, all lines were okay. It was running as same as previous version of code as it did all those years ago except now it has a really beautiful new modern style. As you see C++ Builder is very easy and flexible to handle old projects as a new modern project.

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.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?