Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

The Is The Step-by-Step Guide To Using A C++ Compiler

The Is The Step by Step Guide To Using A C++ Compiler

C++ is an immensely powerful programming language and one of the world’s most with many ready-made variables, functions, methods, namespaces and libraries to enable you to write almost any app you could ever want. Using a fast and reliable C++ Compiler and IDE is very important for beginners and professionals to develop C++ apps for Windows and other operating systems. When a user wants to develop modern C++ applications, they should learn to use a professional IDE. In this post we explain the basics of C++ Builder as a guide for beginners.

An integrated development environment (IDE) is a software application that provides a complete set of features for application development. Code is generally written in text format, and you can easily edit or modify your code using text editors like Notepad, Word, WordPad, UltraEdit or similar. For a developer, beginner or professional, however, an IDE is really important because features like highlights, auto code completion and help system, and the opportunity to run, test, debug, deploy, merge or transform code on other platforms (multiplatform coding) are also important. All these capabilities require a powerful IDE.

Step 1. Download the C++ Builder Community Edition Free

If you are new to C++ and want to compile code for the first time we recommend you try the free C++ Builder Community Edition for students, beginners, and startups. 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, 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. More details about C++ Builder & RAD Studio for the beginners can be found in Official Wiki of Rad Studio.

Here are the features of the C++ Builder CE version;

C++ Builder CE is the easiest and fastest C & C++ IDE for developing simple or professional applications on different operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files and LSP support. C++ Builder comes with Rapid Application Development Studio, also knowns as RAD Studio, and C++ Builder is one of the most professional IDEs that work under RAD Studio.

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.

Step 2. Create a new C++ console project

If you download C++ Builder Community Edition (or RAD Studio CE version) or any Professional, Architect, Enterprise versions of C++ Builder. Install it on your windows computer and run RAD Studio or C++ Builder. Beginners and students normally start to learn C++ with simple code. For this reason, we want to show you how you can create a simple Console Application in C++.

  1. Choose File->New-> “Console Application – C++ Builder” menu
  2. There will be New Console Application window. When you create a console application generally you don’t need VCL or FMX frameworks. So, set Target Framework to None for a standard console application and press OK as below. so you can set the Target Framework to None as below and press OK.

3. Save all Unit File and Project file to a folder.

2. Create a New C++ console project

Step 3. Add Your C++ Code

  1. When you create a console application your C++ code will have a main function and it will look like this,
[crayon-676dcb6f45312429459672/]

2. inside the main() function, between { and }, before the return command add these lines below,

[crayon-676dcb6f4531a041123767/]

or if you want you can clear all code there and copy this standard C++ code to run

[crayon-676dcb6f4531b517011074/]

This example above is a modern “Hello World” example for Windows which runs with C++ Builder. Modern applications have a GUI. VCL projects are Windows only. FireMonkey projects are Multi Device (multi-platform) applications that you can compile and run on Windows, MacOS, iOS and Android .

Step 4. Compile your C++ project

1.. Now you can compile this C++ code; just press the F9 key or just click the Run button in the center of top bar. This will let the IDE check your code and compile both the Unit and project files and link them together. You can also use the Run menu from the top to run your application.

2. You should see this below in a console application

[crayon-676dcb6f4531d627657126/]

3. If you get an error, check your code – it’s easy to mistype or have the braces (“}” characters) in the wrong place. Note that C++ is case sensitive, so upper and lower characters should be also same.

4. Then press the F9 key or just click the Run button again

How to compile Modern and Visual C++ Applications?

If you succeed in the steps above and want to know how to compile modern and visual application in C++, you can start with a simple Hello World example with some visual components. These “Hello World” examples are good to understand features of the compiler, IDE and the 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.

Now let’s create a Visual and Modern C++ example in C++ Builder,

  1. Open C++ Builder or RAD Studio IDE
  2. Create a new MultiDevice Application in C++ Builder from File->New menu. This will allow you to develop multi-OS C++ apps with FireMonkey UI elements. Or you can create a new Windows VCL Application in C++ Builder. This will allow you develop C++ apps with VCL UI elements.
  3. Save all units and project files with “HelloWorld_” prefix in a HelloWorld folder.
  4. Add a Memo (TMemo) and a Button (TButton) from the Palette to your Form. TMemo component is good to display all outputs as in console applications.
  5. Double click the Button to create OnClick() event, inside that Button1Click event write lines as given in the example below,
[crayon-676dcb6f4531e132240216/]

7. Run project by hitting F9 or click Run with Debugging

The output should be like this.


8. If there is error, please check your lines
9. If all is fine then save all project
10. if you check your header file you will see all your objects (Memo, Button etc. ) are automatically defined as below. You don’t need to change anything here

If you are a beginner “Hello World” examples are good to understand features 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, and how to deploy or release the finished program.

This example below is a modern “Hello World” example on Windows which runs with C++ Builder.

If you want, you can switch to your header file (.h) of your cpp file (.cpp) from the button tabs. Your auto-generated header file of your Multi-Device Application will be shown as below,

[crayon-676dcb6f4531f105844196/]

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.

The latest posts along with more examples and tutorials can be found here on the Embarcadero Blog with this dynamic search https://blogs.embarcadero.com/?s=C%2B%2B and in LearnCPlusPlus.org.

Exit mobile version