C++Introduction to C++Language FeatureLearn C++

This Is How To Compile C++ Apps On Windows

How can I compile my C++ app code on Windows? How can I compile Modern C++ code on Windows? How can I compile C++ on Windows with visual UI elements? Let’s answer these questions.

If you are new to programming or even if you coming to C++ from another programming language, sometimes it is hard to understand how to write C_++ code, how to design the screens and how to compile and run your apps. In this post we will explain how to compile C++ code in Windows to produce Modern C++ applications in Windows.

The first thing we need is a modern IDE and C++ Compiler.

Did you know you can download the C++ Builder Community Edition for free?

This image has an empty alt attribute; its file name is CBUIDER_STUDIO_FINAL_ICONS_64.png

Embarcadero’s C++ Builder CE, is a free C++ IDE and compiler suitable for the community of freelance developers, startups, students and non-profits, C++Builder Community Edition is a full featured IDE for building iOS and Windows apps from a single modern C++ codebase. It has a limited commercial use license. C++Builder Community Edition includes a code editor, powerful debugging tools, built-in access to popular local databases with live data at design time, Bluetooth and IoT capabilities and a visual UI designer with support for pixel perfect, platform specific styling.

This Is How To Compile C++ Apps On Windows. The Free Community Edition of C++ Builder

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

  • Build Windows and iOS C++ Applications 10x Faster with less Code.
  • C++Builder Community Edition provides you with an integrated toolchain and professional-level developer tools from Day 1
  • Featuring Clang-enhanced compiler, Dinkumware standard library, MSBuild/CMake/Ninja support, and popular libraries like Boost and Eigen.
  • Develop Windows and iOS applications with a single codebase and responsive UI
  • Enjoy the award winning Visual Designer using the C++Builder VCL and FireMonkey frameworks for maximum productivity
  • Built-in Debugging Tools that allow you to debug on any device
  • Build database apps with local/embedded capabilities
  • Hundreds of included components to enhance your app and reduce development cycles
  • Direct access to InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, DB2, SQL Anywhere, Advantage DB, Firebird, Access, Informix, MongoDB, and more.
  • Licensed for use until your individual revenue from C++Builder applications or company revenue reaches $5,000 US or your development team expands to more than 5 developers

The C++ Builder CE is the easiest and fastest C & C++ IDE for developing everything from simple to fully professional applications on a wide range of 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 known as RAD Studio. C++ Builder is one of the most professional IDEs that works under RAD Studio.

You can download the FREE C++ Builder Community Edition (CE) here: https://www.embarcadero.com/products/cbuilder/starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. You can download and use the trial version for one month with the same capabilities as the full version . Please visit https://www.embarcadero.com/products/cbuilder.

How to Compile C++ on Windows?

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 machine and run RAD Studio.

  1. Choose File->New-> “Console Application – C++ Builder” menu
  2. There will be New Console Application window. Set Target Framework to None for a standard console application and press OK as below
This Is How To Compile C++ Apps On Windows. The new console app screen.

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

4. inside the main() function add these lines

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

This example above is a modern “Hello World” example on Windows which runs with C++ Builder. Modern applications have a GUI and they should be compatible with other operating systems other than just Windows – for C++ Builder this includes MacOS, iOS, and Android. FireMonkey projects are multi device, multi-platform, applications that you can compile and run on Windows, MacOS, iOS and Android.

5. Now you can compile this C++ code in Windows, press F9 key or just press Run button in the center of top bar.

6. You should see this below in a console application

7. Note that C++ is case sensitive, so upper and lower characters should be also same.

8. Then press F9 key or just press Run button in the center of top bar.

Is there an example of how to create a Modern C++ “Hello World” example?

If you are a beginner “Hello World” examples are good to understand feature of that programming language. It helps explain how to edit text, how to write code in the new language, how to compile and link, how to debug and execute, and how to deploy or release. Now let’s create a Visual and Modern C++ Example

  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 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 to Button to create OnClick() event, inside that Button1Click event write lines as given full example below,

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

Output should be like this.

This Is How To Compile C++ Apps On Windows. Helllo World Moden C++ Example.


8. If all is fine then save the project
9. 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, how to deploy or release.

The code below is a modern “Hello World” example on Windows which runs with C++ Builder. Modern applications have a GUI and they should be compatible with other operating systems (Windows, MacOS, iOS, Android). FireMonkey projects are Multi Device (multi-platform) applications that you can compile and run on Windows, MacOS, iOS and Android.

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,

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.

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.

About author

33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux and some other operating systems. Dr. Yilmaz Yoru was born in 1974, Eskisehir-Turkey. He graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. One year later he started to work in the same university as an assistant. He received his MSc and PhD degrees from the same department of the same university. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics and Artificial Intelligence. He also likes the graphical 2D & 3D design and high-end innovations.
Related posts
C++ComponentsLanguage FeatureLearn C++

How To Use A Sharpen Effect in C+ Software On Windows?

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

What Is The Erase WString Method In A Modern C++ App

C++C++17Introduction to C++Learn C++

This Is How Trivial Copy Constructors Work In A C++ App

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

This Is How To Use Bitwise Operators in C++ Software