The C programming language is one of the most popular and versatile programming languages. The C Programming Language was developed in the 1970s and since 1970, C has inspired the invention of a vast array of other programming languages, such as C++. The C++ programming language includes a substantial number of elements of the C language and builds on those solid foundations with object-oriented programming features like Classes, Objects, and Methods. Still, this oldest genie language is popular, mostly in the top 3 but if we consider its other variations and its usage on microchips and IoTs it is the most used programming language.
C and C++ Compilers are great tools to develop when they are paired with a professional C++ IDE such as RAD Studio and C++ Builder.
Table of Contents
What is a C or C++ compiler?
A C or C++ Compiler is a computer program that converts the high-level instructions of the programming language (i.e. C/C++ source code) written with text into executable machine code in partnership with a linker. In general, all computers work with machine code executable packages – code that can be directly run by the operating system. This is the most low-level and fastest code, but it requires writing many lines for simple things and is hard to generalize for all kinds of machines.
Is a C++ IDE the same as a C++ compiler?
The term C++ IDE refers to the entire integrated development environment. Technically. the compiler is the part of the C++ IDE which interprets the program’s source code and converts it in object code. This object code is the ‘linked’ by another related process called, perhaps unimaginatively, the linker. The entire C++ IDE includes the specialized text editor in which the programmer writes the program’s source code and designs the screen layouts as well as menu options or shortcuts to tell the C++ compiler to compile the source code and the linker to link it into the final program executable or app package.
Are a C compiler and C++ compiler different?
Most C compilers only ‘understand’ programs written in the C programming language. However, since C++ is a mostly a kind of superset of the C language you will find that the C++ compiler can compile nearly all C programs too. This is definitely the case for C++ Builder which can compile both C and C++ source code without any problems at all.
How can I download the latest C++ Builder for free to compile and run a C program?
The C++ Builder CE version is free C and C++ IDE for building simple or professional applications on the Windows, 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. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio, and C++ Builder is one of the most professional IDEs that work under RAD Studio. C++ Builder comes from a venerable history which began with the incredibly popular Borland TurboC in 1990. This was later renamed Borland C++ Builder. Under the Embarcadero brand, it comes with new versions, features, updates, and support. 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.
Here are the features of the C++ Builder 11 version;
- Provision apps for Windows 11
- Compile for Android API 30
- Compile for M-series (Apple Silicon) processors
- Design on high-DPI 4k+ screens
- View VCL Styles in design time
- New & modernized VCL components
- Use enhanced remote desktop support to collaborate remotely
You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.
See What’s New in C++ Builder 11
Download C++ Builder 11 Now
How to compile and run a C program in terminal with the C++ Builder IDE?
You can use C++Builder to develop a C console application, or to develop a C++ console application or a C++ Visual Application with GUIs like buttons, edit boxes etc. C++ Builder is a good tool to develop C and C++ applications from the beginner level to higher professional levels.
How to start coding in C++ Builder to compile and run a C program for the terminal or command line
- Install and Run the latest RAD Studio or C++ Builder CE
- Create a new Console Application from the File->New->Console Application C++ Builder menu as below,
3. In the next window, select Target Framework as None and If you are sure you will use C language only then you can select C language. If you want to use C language and may be you can use C++ features in the same code, then you can select C++ source type. And press OK to create a new application.
4. Now, you can start to write your first C codes into Code Editor of C++ Builder IDE. Here is a simple Hello World example as below,
Here first add library headers with #include < > command. Then we define our main() program with { and } .Between these we write our main program. We can use printf(” “); function to write text outputs. Then we can wait for a character input (a key press) by the getchar(); command. Finally we can write return 0; to let application know it is done successfully. If you have problem to type you can use this full example below.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#include <stdio.h> int main() { printf("Hello C Langauge"); getchar(); return 0; } |
5. Now we can compile and run our application. Press Run Button or just Press F9 to compile and run your first C example.
How to compile and run a C program in the Terminal or command line with the RAD Studio Command Prompt and MSBuild?
If you create and save your C++ Builder C development project as described above, you can run RAD Studio Command Prompt.
1. First be sure that RAD Studio or C++ Builder is installed and the project and C files of this project is saved in a folder.
2. Press Windows Key and write “RAD” then in Windows Menu choose” RAD Studio Command Prompt”. This will execute Command Prompt with RAD Studio settings.
3. Use CD command to navigate to your project folder. For example,
1 2 3 4 |
D: cd D:\#PROJECTS\ConsoleApp |
4. type dir command to see your C project files
5. *.cbproj file is your project file. Use msbuild to use MS Build app. This will build your application with project settings, it will use appropriate c compiler and linker defined in this project file. For example,
1 2 3 |
D:\#PROJECTS\ConsoleApp> msbuild ConsoleApp_Project1.cbproj |
6. This will compile and list you errors and warnings as given example below,
7. The executable file is generated in an output folder. This folder can be Win32, Win64, iOS, Android etc. You can check these folders by cd and dir commands. And also project can be in Debug or Release folders, depends on your project. Our project was 32bit Windows Console Application (Win32) and it was in Debug mode (Win32\Debug folder). So we can navigate to Win32 and Debug folder as below,
1 2 3 4 5 |
D:\#PROJECTS\ConsoleApp> cd Win32 D:\#PROJECTS\ConsoleApp\Win32> cd Debug D:\#PROJECTS\ConsoleApp\Win32\Debug> dir |
If you type dir command you will see all output files in Debug folder as in example below,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
D:\#PROJECTS\ConsoleApp\Win32\Debug>dir Volume in drive D Directory of D:\#PROJECTS\ConsoleApp\Win32\Debug 07/17/2022 09:07 PM <DIR> . 07/17/2022 09:07 PM <DIR> .. 07/17/2022 09:07 PM 647 ConsoleApp_File1.obj 07/17/2022 09:07 PM 159,744 ConsoleApp_Project1.exe 07/17/2022 09:07 PM 524,288 ConsoleApp_Project1.ilc 07/17/2022 09:07 PM 65,536 ConsoleApp_Project1.ild 07/17/2022 09:07 PM 1,310,720 ConsoleApp_Project1.ilf 07/17/2022 09:07 PM 2,031,616 ConsoleApp_Project1.ils 07/17/2022 09:07 PM 246 ConsoleApp_Project1.map 07/17/2022 09:07 PM 96 ConsoleApp_Project1.res 07/17/2022 09:07 PM 196,608 ConsoleApp_Project1.tds 07/17/2022 09:07 PM 305,244 ConsoleApp_Project1PCH1.pch 10 File(s) 4,594,745 bytes 2 Dir(s) 1,101,161,197,568 bytes free |
8. Now you can execute the executable *.exe file
1 2 3 |
D:\#PROJECTS\ConsoleApp\Win32\Debug> ConsoleApp_Project1.exe |
How to compile and run a C program in the Terminal or command line with RAD Studio command prompt and compiler?
If you don’t want to use project settings and you just want to compile a *.c file you can use compilers listed in bin directory of C++ Builder or RAD Studio. For example for an 32bit Windows application you can use C++ Builder Compiler for Windows 32bit bcc32.exe as below,
1 2 3 |
D:\#PROJECTS\ConsoleApp> bcc32 ConsoleApp_File1.c |
or you can use bcc32c C++ Builder CLANG Compiler for Windows 32bit as below,
1 2 3 |
D:\#PROJECTS\ConsoleApp> bcc32c ConsoleApp_File1.c |
Note that when you compile a C file in this way, compiler will generate all exe and other output files to the same folder.
Don’t forget, you can also use Borland C++ Compiler and Dev-C++ to compile C programs. We highly recommend you use C++ Builder CE version that may allow you switch to the professional version easily.
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.
For students, beginners, and startups you can download a free C++ Builder Community Edition. If you are a professional developer, you can download a free trial copy of Professional, Architect, or Enterprise versions of C++ Builder.
Design. Code. Compile. Deploy.
Start Free Trial
Free C++Builder Community Edition