The C language is one of the most powerful and popular programming languages. It can be run by C++ windows development tools, C/C++ compilers and IDEs. Using a fast and reliable C or C++ compiler for Windows is very important for beginners and professionals since it helps C/C++ developers in remembering which language features exist, how to use them, and even detect errors when we get them wrong. C language still popular among developers and it has many pre-defined variables, functions, and libraries.
Today we have many free C++ IDE and compiler tools like C++ Builder CE, , Dev-C++, BCC32 Compiler, VS Code, and others. C++ Builder has free C++ Builder Community Edition and C++ Builder Professional / Architect / Enterprise versions for professional programmers and coding teams.
C++ Builder is a modernized professional IDE with a great set of features, components, C and C++ compilers to help you efficiently create amazing C++ software for the different OS platforms. The C++ Builder is a modern IDE for creating apps written in the C language and C++. There is a new release of RAD Studio / C++ Builder version 11.1.5 with a Code Insight Update. This is a quality release focused on C++ Code Insight and related features for C++ … Continue reading
Table of Contents
How to run a program written in the C Language with C++ Builder?
Simply, you can run C code using the C++ compilers and build tools built into C++ Builder.
1. Download the free C++ Builder Community Edition and install it.
2. In C++ Builder, create a new console application from the File->New->Console Application – C++ Builder menu . Chose C Language as a Source Type and Target Framework as None from the next window and pres OK. ,
If you are new to programming, here is a quick introduction to create a simple C language program. C programs (C code) are actually plain text files, which means you can use any editor to edit them such as Windows Notepad, Notepad++ and so on. But full C++ IDE’s have many more features to edit and run C Programs than simple ‘dumb’ text editors. Dev-C++, RAD Studio, C++ Builder, are all examples of C++ IDEs which can also edit and compile programs written in the C language. Before you start, you should download and install a free C and C++ compiler and IDE. Then run your IDE, now you can write your C code here to begin.
When you start coding, first of all, you should include libraries that you use. Generally, for beginners stdio.h library is enough for simple beginner apps. We can include this library as below,
1 |
#include <stdio.h> |
Second, you should add the main procedure (the main program, the main function) as below,
1 2 3 4 |
int main() { } |
After that you should write your programming code lines into this procedure, between { and } brackets. If you are a beginner “Hello World” examples are good to understand feature of that programming language. It is good to understand how to edit text, how to write in its format, how to compile and link, how to debug and execute, how to deploy or release. This full example below is a “Hello World” C example that can be run with C++ Builder.
1 2 3 4 5 6 7 8 9 |
#include <stdio.h> int main() { printf("Hello World"); getchar(); return 0; } |
In C++, after every command you use you should put ; to the end of your commands. In this example above we print a text with printf() function and then we wait to get a character input (key press) with getchar(); functions, then we exit and return 0; which means our main app successfully run and exit.
In this example above we define main() function as a integer (int) function, that means we should return a integer value. Here, we print a text with printf() function and then we wait to get a character input (key press) with getchar(); function, sometimes this is necessary to see results when running it. Then we exit and return 0; which means our main app successfully run and exit.
3. You can simply press Run Button or F9 key to compile and run, or you can use Menu to compile and Run too.
4. If you want to run this program in Console then execute RAD Studio Command Prompt from the Windows menu in Windows. This will open Command Console (Terminal) with RAD Studio / C++ Builder configs. After this step, in Terminal, go to folder of your C file and type bcc32 and your file name. For example, you can compile your app as below,
1 |
D:\MyApp> bcc32 myapp.c |
To run your compiled app, you can type compiled excitable file name which has .exe extension of you C file. For example, to run compiled myapp.c file write its executable output as below,
1 |
D:\MyApp> myapp.exe |
How to run a program written in the C language with A free C++ compiler?
There are different Embarcadero C++ Compilers for different purposes. These are bcc, bcc32c, bcc32x, bccaarm, bcc64 executable compilers. There is a free Win32 compiler officially listed as a free C++ Compiler in the Official Web Page of Embarcadero.
This free download of the C++ Compiler includes C11 language support, the Dinkumware STL (Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker and resource compiler.
The Free C++ Compiler download includes:
- Embarcadero C++ Compiler (bcc32c/bcc32x)
- Turbo Incremental Linker (tlink32)
- C++ Win32 Preprocessor (cpp32)
- Import Library utility—for creating import libraries from DLLs (implib)
- Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
- Other useful command-line utilities such as make, grep, and touch
- Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)
C++Builder includes compilers for Win32, Win64 and iOS. And, C++Builder also features a modern, high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform UI development. Learn more about RAD Studio on its product page.
How to compile a C program in terminal?
You can simply use one of these C++ compilers to compile C programs in terminal. For example, if your c program file is myproject.c
you can compile this with optimization level 2 (-o2) as below,
you can use classic bcc32 compiler as below,
1 2 3 4 5 6 7 |
bcc32 myproject.c -o2 myproject.exe |
or you can use bcc32c CLANG compiler as below,
1 2 3 4 5 6 7 |
bcc32c myproject.c -o2 myproject.exe |
or you can use bcc32x compiler as below,
1 2 3 4 5 6 7 |
bcc32x myproject.c -o2 myproject.exe |
How to run a program written in the C language with GNU C/C++ compiler?
GNU GCC is another powerful C/C++ compiler originally written as the compiler for the Unix, Linux and GNU operating system. The GNU system was developed to be 100% free software, and it is efficient with both 32-bit and 64-bit operations. This compiler can be used on Windows using MinGW or CygWin Linux Simulators. Compiled executable files need a small dll to run independently on Windows. It is mostly compatible with CLANG standards.
GCC Compiler can be used by Visual Studio Code, Dev C++, Code Blocks, and can be directly used with Command Prompt or PowerShell. It is available on the official product page https://gcc.gnu.org/.
GNU C/C++ compilers can be directly used in Linux, or it can be used with MinGW Linux Simulation (with GNU C/C++ Compiler) to develop C++ applications running on the command console. It is the most well-known compiler in Linux.
To execute a C language program in the Linux terminal?
In Linux, GNU C/C++ comes as default language installed. Generally, the gcc compiler is used as a C compiler while the g++ compiler is used as C++ compiler. If your c program file is myapp.c
you can compile this with gcc command as below,
1 2 3 4 5 |
gcc myapp.c -o myapp.out |
Be sure that you have permission to write to folder there. Now you can easily run your myapp.out
as given below,
1 2 3 4 5 |
./myapp.out |
Here is the full input and output process in Linux terminal
1 2 3 4 5 6 7 8 9 10 11 12 13 |
> ls myapp.c > gcc myapp.c -o myapp.out > ls myapp.c myapp.out > ./myapp.out |
How to run a program written in the C language with a professional C++ compiler?
In general, you can run c programs with the latest C++ Compilers and Editors today. C++ Builder Professional, Enterprise and Architect Editions are able to run C programs. There is a free C++ Builder Community Edition for students, beginners, and startups too. Simply you can download, install and run your C programs in console applications. Moreover, you can enhance your C programs with C++ features and modern GUIs, which means you can mix and use C and C++ together. For the best modern app, later if you wish, you can update your C program to a C++ program.
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. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio, and C++ Builder is one of the most professional IDE’s that work under RAD Studio. It is the oldest IDE (it began as Borland TurboC in 1990 and was later renamed Borland C++ Builder). Under the Embarcadero brand, multiple new versions have been released, year upon year, along with great new features, updates, and support to ensure that your apps can stay current. 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.
You can simply use RAD Studio Command Prompt to compile and execute C programs in terminal. For example, if your c program file is myproject.c you can compile this with optimization level 2 (-o2) as below,
1 2 3 4 5 |
bcc32c.exe myproject.c -o2 |
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.