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

How To Build A C++ Program?

How To Build A C++ Program

The C++ programming language is easy and very simple to build native programs in different operating systems. If you want to start programming in C++ but don’t know where to start, we have a simple post for you. In this post, we explain simply how you can download a free C++ Code Editor and compiler and how you can start coding with simple examples as a first step.

C++ is one of the most popular programming languages and often features among the two three languages on any lists. C++ is a powerful programming language with many features that 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.

How to download and build a C++ program?

How To Build A C++ Program? The C++ Logo

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.

How To Build A C++ Program? The RAD Studio IDE

C++ Builder IDE has mainly 5 Parts, the Code Editor Window and Form Designer, Projects Window, Palette Window, Structure Window, Object Inspector Window. You can find more , less commonly used windows from the main IDE menu as well as the right-click context menus. All the basic sections can be summarized in this IDE picture;

How to build a C++ program in a code editor, C++ Builder in example?

If you download C++ Builder Community Edition (or RAD Studio CE version) or any Professional, Architect, Enterprise versions of C++ Builder, or Dev-C++, VC++, GNU C/C++ then we can start to code, you can follow these steps to run your program,

  1. Create a new Project (a console application, a solution)
  2. Save all your project files to a folder. Use File->Save Project As to save all your files.
  3. Start coding with very simple code and save all project files including cpp files.
  4. Press Run Button or Keys of IDE, or use a compiler to compile your code.

As an example, now, let’s do these steps in C++ Builder.

  1. Use menu File ->New->”Console Application – C++ Builder” to create a new C++ console application. In the next window, press OK to write your code.

When you start coding, first of all, you should include libraries that you wish to use. The C++ language has many libraries and each of them has commands or functions for specific tasks. For example, the iostream library has standard input and output methods to display data and read from files and similar sources. Generally, for beginners, the iostream header is enough to enable you to create simple apps. We can include this library header as below,

Second, you should add a main procedure. This is the main part of the program – hence the name – and it is executed first. In the simplest sense, all other parts of your program are launched from the main section either directly or indirectly. Things get a little more complicated than that once you start to write more complex programs but for now you can think of the main section as the ‘main loop’ where things begin to happen in your program code.

After that you should write your lines of program code into this procedure, between the { and } brackets. If you are a beginner, “Hello World” examples are good to understand how the basic feature of a particular programming language works. It is also a good way to understand how to edit text, how the syntax (the rules) of the language work, how to compile and link, how to debug and execute, and how to deploy or release. This full example below is a “Hello World” C++ example that can be run with C++ Builder too.

Here is Hello World C++ example as a console application,

In C and C++, after every command you use you should put a semicolon “;”. In this example above we print a text with std::cout method 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 has run successfully and exits.

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 ran and exited.

2. coding is done now you can save all your project files to a folder. Use File->Save Project As to save all your files.

3. After this step, you can compile and run by pressing F9, or you can run your code by pressing F10, or you can use Compile and Run buttons editor. This will print out the “Hello LearnCPlusPlus”. Note that C++ compilers support the C language too

How to build and run a C++ program in Dev-C++?

You can write the above C++ code into Dev-C++ code editor, or you can copy and paste it. If you are a beginner, we highly recommend you write code rather than just copy and paste it. This will help you to understand how C++ works and you can see your first mistakes when you are coding.

  1. Create a new Project in Dev-C++,
  2. Write your C++ code, as in example above,
  3. if coding is done now you can save all your project files to a folder. Use File->Save Project As to save all your files.
  4. After this step, you can compile and run by pressing F9, or you can run your code by pressing F10, or you can use Compile and Run buttons editor. This will print out the “Hello LearnCPlusPlus”. C++ compilers support the C language too

Although the free C++ Builder Community Edition is extremely powerful it is intended for students, beginners, and startups. If you are a regular business or do not qualify for the free community edition, then you can download a free trial of the very latest full RAD Studio C++ Builder version.

How To Build A C++ Program? The C++ Logo

C++ Builder is the easiest and fastest C and C++ IDE for building everything from simple to 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.

Download RAD Studio 11 Now

See What’s New in RAD Studio 11

close

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 33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He was born in 1974, Eskisehir-Turkey, started coding in college and graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. He worked as a research assistant at the same university for more than 10 years. He received his MSc and PhD degrees from the same department at the same university. Since 2012, he is the founder and CEO of Esenja LLC Company. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17Learn C++Templates

Learn How To Eliminate Pointers In Templates in C++

C++C++11C++14C++17Learn C++Templates

Learn To Export And Import Template Members From A DLL Or A Package In C++

C++C++11C++14C++17Learn C++Templates

What Is A Function Template In C++?

C++C++11C++14C++17Learn C++Templates

What Is A Class Template In C++?