When you start to develop a C++ app there are number of tips and tricks that come from experienced developers which can be helpful to you as your start your journey as a C++ developer. In today’s article we gather together a list of 10 top tips to smooth your path as a C++ app programmer.
Table of Contents
1. Download the latest C++ Builder 11 (RAD Studio 11) Community Edition / Professional / Architect / Enterprise
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications for 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. 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.
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 a trial version of C++ Builder.
2. Use a CLANG compiler that supports C++17
CLANG is considered to be a production quality C, Objective-C, C++ and Objective-C++ compiler when targeting X86-32, X86-64, and ARM. It is a new C/C++ compiler standard (C++98, C++11, C++17, C++20, C++23 etc) supported by The LLVM Compiler Infrastructure Project, and has been a default compiler in recent years for most C/C++ compilers. This means that if you code for a CLANG compiler, most other IDEs, Compilers of Platforms will support your code without any changes. The latest C++17 standard is supported by the most C++ compilers. More information about core language features can be found here.
We highly recommend you start with or to move to a CLANG Enhanced compiler like Embarcadero’s C++ Builder, which supports the CLANG C++ 17 standard and has its own C++ Compiler, IDE, GUI designer and more. A description of the C++Builder enhanced compiler features can be found here.
C++ Builder includes compilers for Win32, Win64, Android and iOS. C++Builder has both CLANG Enhanced C/C++ Compiler and a Borland C/C++ Compiler. It also features a modern, high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform UI development. You can develop GUI based applications easily, as it 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 that can be used by students, beginners and startups who fall within the community edition applicability requirements.
3. Use the FireMonkey FMX UI framework to create your cross platform C++ app
C++ Builder comes with VCL and FMX UI Frameworks. VCL Applications are focused on Windows-based applications. C++ Builder FireMonkey (FMX) Applications are Multi-Device Applications for Windows and for other operating systems like iOS, Android, etc. Here are the main parts of the C++ Builder IDE,
The FireMonkey framework is the app development and runtime platform behind RAD Studio, Delphi and C++Builder. It has about same components as VCL framework. The key difference is that the VCL is focused on Windows app development. FireMonkey is designed for teams building multi-device, true native apps for Windows, OS X, Android and iOS.
If in the future you’re considering that you might expand to develop multi-platform apps, or to switch to different operating systems we highly recommend FireMonkey. If you focus only Windows then VCL apps may offer you closer integration with specific Windows features although both the VCL and FireMonkey are great choices and which one you adopt might be a matter of personal preference if you’re not considering anything other than Windows as a target.
4. Use TwineCompile to speed up your C++ app compilation times
TwineCompile is a good solution to speed up your compile times and save you a lot of time. The developer says it may improve your compile time up to 50 times. It integrates directly into the C++Builder IDE, where drastically reduces the compile/make/build times by employing techniques such as multi-threading, file caching and automatic background compiling.
- Advanced compile system uses multi-threading technology and caching techniques to make C++ compiles 50x faster!
- Automatic background compiling engine ensures that files are compiled as fast as they are saved!
- Tuned pre-compiled header handling system automatically maximizes simultaneous use of pre-compiled headers between multiple threads!
- Seamless integration into the C++Builder IDE. Supports all versions including C++Builder 11.0!
- Theme support for all IDE themes providing a unified workspace!
- Full support for 32-bit and 64-bit compilers!
- Parallel project build support compiles multiple projects in parallel, drastically reducing the time to build complex project groups!
- FinalBuilder integration provided out of the box!
More details can be found in the official TwineCompile web page.
TwineCompile also has an automated background compilation feature. Here is a post about this:
5. Use the latest Visual Component Library in your Windows C++ app design
Many of component properties and methods are the same in VCL and FMX projects. If you are a beginner we highly recommend you to watch this Introduction To C++ Windows Development With C++Builder video to understand C++ Builder / RAD Studio IDE interface and some basic mechanisms. This video will help you how to create simple C++ Builder projects. So you can easily adapt to development of your projects. C++ Builder comes with many many modern components. Simply you can add them by dragging them from the Palette window to your application design view.
FireMonkey, recommended above, is for cross-platform apps including for Windows. The VCL, recommended here, is for Windows only, and so looks and feels native and is a great choice if you’re targeting only Windows for your software.
You can download many free and trial versions of components and libraries via Get-It Package Management. The GetIt package manager comes with the RAD Studio and C++ Builder IDE. If you need examples for some basic components, we have a quick look at components post series on LearnCPlusPlus.org. Please check them for more details about basic components. Here are some of the available component packs this year,
6. Use modern visuals such as skins and styles at design time and at run time
Your C++ app should support the latest UI visual look, feel and behavior so that your users feel it is a modern, professional offering. In addition, adding support for custom UI designs (Skins or Styles) can help add help “surprise and delight your users” by allowing them a greater choice over personalization and customization. Using styles on your new projects should be very easy, they should be easily removed which allows your visuals in standard visuals of windows. You should be able to design your application view in normal ways with buttons, labels, edit boxes, memos, trackbars, panels, switches, etc. You should be able to set one style to all of your components or you can choose different styles on different forms or different components. In addition, users should easily install and uninstall these kinds of styles, skins via IDE tools.
One of the most important parts is seeing visuals in design time and when coding is that it enables developers to design their best UI forms during development rather than having to continually run the C++ app to view the results and then swap back to the IDE to make changes. With RAD Studio you can apply custom visual styles at design time and, using the live mobile view, easily switch to other operating systems to compare the way the different user interface elements appear on different operating systems and device types.
Styles are sets of graphical details that define the look and feel of a application visually and they are one of most beautiful and useful UI feature of RAD Studio, that makes your UI elements skinned with professionally designed with different Styles. Official Styles are designed by Embarcadero’s Designers. There are other 3rd party Styles available too and you can also generate your own custom styles with the built-in style designer. Styles are similar to themes in Windows or skins of applications.
7. Use High DPI settings
High-DPI support in the IDE, with full support for the latest 4k+ monitors, and cleaner and sharper fonts and icons throughout helps reduce visual fatigue while coding and gives more screen real estate for your various code and debugging windows. Improved FMX High-DPI support in runtimes for Windows and Desktop means there is a visibly superior desktop UI for your own apps. High DPI support includes support in the code editor, for crisp text, and when designing forms, both VCL and FMX. Please read more here about why it is important:
8. Use modern data connection wizards and components, Live Bindings and Data Bindings
Live Bindings and Data Bindings are based on relational expressions, called binding expressions, that can be either unidirectional or bidirectional. LiveBindings is also about control objects and source objects. By means of binding expressions, any object can be bound to any other object, simply by defining a binding expression involving one or more properties of the objects you want to bind together. For example, you can bind a TEdit control to a TLabel so that, when the text changes in the edit box, the caption of the label is automatically adjusted to the value evaluated by your binding expression. Another example would be to bind a track bar control to a progress bar so that the progress bar increases or decreases as you move the track bar.
Modern applications use modern databases with modern data connections and data bindings. If you are developing a modern app, your database should be modern too. We highly recommend you online and modern databases as much as possible, while your app may be an offline app. Because you may move your app to online or some of your codes in another online app.
C++ Builder has a great official database component, the FireDAC component pack. FireDAC is one of the great components for database connections that comes with RAD Studio, C++ Builder and Delphi. FireDAC is a Universal Data Access library for developing applications for multiple devices, connected to enterprise databases. With its powerful universal architecture, FireDAC enables native high-speed direct access from Delphi and C++Builder to InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, DB2, SQL Anywhere, Advantage DB, Firebird, Access, Informix, DataSnap and more, including the NoSQL Database MongoDB.
FireDAC is a Universal Enterprise Data Connectivity
To use FireDAC with C++ Builder, be sure that your RAD Studio, C++ Builder version has support for this component. We highly recommend here C++ Builder 10.x or above because of improvements on database connections. If you don’t have this component in your version there is a Trial version of FireDAC that you can test and then you can purchase if it meets your needs. In a new C++ Builder Project, VCL or FMX) you can drag and use its components on your forms. Most experienced programmers prefer to add a new DataModule to their project.
Some database posts about how to connect your C++ apps to modern databases like Interbase, PosgreSQL, MySQL and others are here: https://blogs.embarcadero.com/?s=database
9. Use debugging features to find your runtime errors before your users do
Be sure that your IDE has built-in Debugging tools that allow you to debug on any device. You should able to build and debug apps with local/embedded capabilities. The Debug Inspector enables you to examine various data types such as arrays, classes, constants, functions, pointers, scalar variables, and interfaces.
These are important parts of debugging,
- Stepping – Step by Step Debugging Through Code
- Evaluate/Modify – Investigate Expressions
- Breakpoints – Pause and Check
- Watches – Tracking Values
- Exceptions – Displaying the stack trace
10. Use IDE tools and options for more rapid developing skills
In modern C++, modern programming or in other ways in professional programming we mostly refer to a lot of libraries and other tools that helps us to modernize our applications. They also help to save time, to save us to see a lot of code lines, to save us to learn and focus on more areas. One of the most strong part of C++ Builder is its components and libraries, plus it supports 3rd party components and libraries. GetIt also a good place for developers who wants release these kind of libraries and tools.
The GetIt Package Manager, is an official tool (a window form) of RAD Studio IDE that comes with C++ Builder and/or Delphi. GetIt Package Manager lets you search and browse available packages (C++ or Delphi Components, Libraries, Components for IoT, Styles, Sample Projects, Tools, IDE Plugins, Patches, Trials). From this window you can install, uninstall, update, or subscribe to these packages. Currently it has about 300 components, all are in up to date, and able to run on the latest RADS version. With these more than 300 of included components, you can easily enhance your apps and you can reduce development cycles and time spend.
In RAD Studio there is a superbly useful tool called the REST Debugger. It comes included with RAD Studio C++ Builder. It is very useful to test REST Requests such as “Gets” and “Posts” to see what effect they have and view their results. It is very easy to automatically set up the REST components with their parameters, which can then be pasted or copied into your source code – potentially saving you hours of coding. We can easily set up the components by using the REST Debugger Tool in RAD Studio – either C++ Builder or Delphi – it works with both.
You can launch the REST Debugger from the Tools menu of RAD Studio. The Embarcadero REST Debugger empowers developers to explore, test, and ultimately understand how a RESTful web service works. You can dive right into REST data with filterable JSON blobs, streamlined OAuth 1.0/2.0 authentication, and configurable request/resource parameters. You can directly copy and paste REST components from the REST Debugger to the RAD Studio, Delphi, or C++Builder IDE. This enables the configuration and consumption of REST services in Delphi or C++Builder apps with just a few clicks. The REST Debugger allows you to test your connections REALLY easily and you can easily see how to reach or transfer your data. There is also a free version that can be used by other REST tools and it can be downloaded from RESTDebugger.
All development cycle requires a lot of steps. At the end, you need a release version of your application. And your application may require additional files, dlls, images, sounds, databases. At the final stage, all should be packed and they should have Provisioning options and developer should easily deploy his application to the appropriate operating systems or its application store.
RAD Studio has great deployment options for Multi-Device FMX projects, not only for Windows apps but also for the Android, and iOS apps. There are options to change icons, splash screen and more specific deployment options can be handled via project options.
Professional application deployment is very important to setup packages safely for the operating system. For example, Windows needs MSIX deployment package for Windows Store of Microsoft, and Android apps needs deployment packages for Google Play and iOS apps needs deployment packages for the App Store of Apple.
RAD Studio directly supports creating MSIX packaging for both your Delphi and C++ Builder apps directly via the RAD Studio IDE It is easy to create a new MSIX package for your own programs so that they are professional, modern packages. If you would like to release your VCL or FMX framework-based Windows C++ applications in MSIX package form, you should know how to create a MSIX package in C++ Builder. RAD Studio 10.4.2 release and above, including the Latest RAD Studio 11, has support for MSIX packaging of Windows applications, for Microsoft Store and Enterprise deployment.
C++ Builder is the easiest and fastest 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. 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.