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

13 Things About C++ Software You May Not Know

13 things about c software you may not have known

C++ is an incredibly versatile, powerful, multi-purpose programming language. There is quite literally nothing that cannot be done with C++ whether it be a low-level, close to metal system application which pulls out the maximum amount of power from the computer to the most modern applications with the very latest innovations in user interface design and hardware integrations. A truly great C++ IDE includes features to allow the developer to develop even highly complex C++ software easily and with the maximum possible productivity. There is a huge treasure trove of tips, tricks, tutorials and example videos available to get you up and running with C++ too. Here’s a just a small sampling of just a few of them.

1. How to build and compile your applications at maximum speed with TwineCompile

Developers don’t want to sit around waiting for the compiler to turn their code into executable programs. Luckily, C++ Builder allows you to use the excellent TwinCompile component that allows developers to drastically improve compilation speeds to compile a project in few seconds. TwineCompile is integrated directly into the C++Builder IDE, it dramatically reduces the compile/make/build times by employing techniques such as multi-threading, file caching and automatic background compiling.

If you don’t have TwineCompile installed yet you can head over to Embarcadero GetIt to find out more and then install it into the IDE.

TwineCompile lists its features as:

2. Did you know how easy it is to run Python in C++ Builder apps?

There is a Python4Delphi component by Kiriakos Vlahos. This component allows you to run Python code in C++ Builder.

3. Can I run Delphi / Object Pascal code in my C++ apps?

Yes you can! Delphi and C++ Builder are a marriage made in heaven. C++ Builder is using C and C++ based CLANG compatible Embarcadero C++ Compiler. RAD Studio is designed for Delphi and C++ Builder. If you are using RAD Studio which has both C++ Builder and Delphi installed, then you can use can compile Delphi files in your C++ projects. This allows some benefits to use some supported Delphi components, libraries, units and similar elements.

At the compiler level, you can also link Delphi outputs to your C++ projects. Please follow this article if you want to know more about this,

4. Have you used folding scopes in your code yet?

In the latest C++ Builder versions, there are folding and unfolding icons near the code lines that allow you to easily fold and unfold your functions, methods and classes. This folding region, as it is also called, will shorten the visual display of your code so it makes it easier to get an overview at a glance of what is going on in your code. To fold a scope just click [-] icon on the left side of the code line. This will return to [+] icon and it will collapse all code lines between { and } scope elements. You can press [+] icon to unfold that function, method or class. The code is still there, it’s just ‘folded’ in the visual display for those times when you don’t need to see the details and want to fit more on the screen at one time.

5. Do you create debugging breakpoints the easy way?

In C++ Builder, you can create break points very simple by clicking the left side of the code.

Creating a breakpoint at a code line in RAD Studio is very easy. To create a breakpoint, just click the left blank side of the code line that you want to break. This clickable area is in the code window and at the left side of the code line. When you click that area it will create a breakpoint that shown with a red icon as below. For example, as in this example we want to stop before the line that has “ShowMessage(“ok2″)”; we click the point where is the normally blank as in shown with a red dot below,

6. Are you using Ctrl+Space for Code Completion and Code Insight?

The Code Completion window displays a list of properties, methods, and events when you enter a class name followed by a period in the Code Editor. You can then select an item and press Enter to add it to your code. If you have new project you need to save your project files first before you use code completion.

If this option is not checked, you can still invoke Code Completion by pressing Ctrl+Space. The default value is ON (checked).

Auto invokeBrings up the Code Completion list while you type Delphi or C++ code. C++ also supports the -> for invoking Code Completion.
Auto parenthesisAutomatically adds parentheses to function calls when you invoke Code Completion.
HistoryRemembers what you have entered or selected, and places that as the first entry in the Code Completion list.
Show reserved wordsIncludes language keywords (for Pascal only) in the Code Completion list.

Note: For the Clang-enhanced compiler, this feature uses a Language Server Protocol server. It is asynchronous and non-blocking.

7. Did you know you can hit the Tab key for Code Template completion?

The Code Template Completion make your coding easy. auto-generated code makes your development easy. It automatically adds a code template when you type a token that starts a template and press TAB. The default value is ON (checked).

Auto completeInvokes code template completion when you press SPACE after you begin an existing template. When this option is disabled, you must press TAB to invoke template completion after you type in the template name. The default value is ON (checked).
HintsEnables template hints. Template hints appear when you add a template in the Code Editor and tab between the preset cursor positions in the template. The default value is OFF (unchecked).

For example, if you type for and then you press Tab key, this will generate Code Template about the for() function as below,

8. Are you using Error Insight to speed up your development?

The Error Insight feature underlines code or HTML that may need attention, such as invalid code causing errors, warnings, and/or hints. Positioning the cursor over invalid text displays a tooltip window containing the probable cause of the error. The default value is ON (checked).

Show Error insight levelsChoose the level of error insight you want to see in the code editor.NoneChoose this option to not display any level of error insight in the code editor.Errors OnlyDisplays errors only in the code editor. Errors are displayed with a red squiggle.Warnings and AboveDisplays warnings in the code editor. Warnings are displayed with an orange squiggle.Hints and aboveDisplays Hints in the code editor. Hints are displayed with a blue squiggle.EverythingDisplays all levels of error insight in the code editor.
Editor rendering styleChoose the underline style, choices are: ClassicSmooth WaveSolid Line, or Dots.
Show Error Insight in editor gutterEnable/Disable this option to find errors, warnings, and/or hints icons at its specific location while scrolling the file in the code editor.

This feature allows you to detect errors and warning without doing compilation which means it reduce your coding and development time. For example you forget to define a variable and you are using it in a line then you can see error icon nearby that line as below.

9. How to use RAD Studio Deployment Manager to add your application’s sounds, images and other ad-hoc files

This tip also applies to Delphi applications as well as C++ programs. The Deployment Manager lets you deploy multi-device applications for any of the supported target platforms. For WindowsOS X, and iOS, the Deployment Manager works with the Platform Assistant, so the application being deployed must use the Platform Assistant server and a connection profile. For Android, you only need to add an Android SDK to RAD Studio to deploy your applications locally.

The Deployment Manager allows you to enable, view, add, delete, or edit the files that are being deployed. You can also use the Deployment Manager to add other necessary “featured files” to the deployment, such as database drivers for the target platform.

You can easily use Deployment Manager to add your files which are running under your project folder. For example you can add music, sounds, image files, some offline databases or other files which are used with your application can be added by the Deployment Manager. You can setup different configurations for the different compile and OS-specific configurations.

10. How do I use the Ctrl+ F1 Help key to find details about a method?

If you don’t remember a method or function and you need help, move your cursor on that command and press Ctrl+F1 to invoke the Help system to search this.

The standard way of activating help in applications is pressing F1. RAD Studio IDE supports appropriate options to define help parameters for automatic generation of code for activating help on pressing F1. In this case, RAD Studio automatically generates the default code necessary to execute an appropriate call to the help-handling function on pressing F1 in VCL applications.

The displayed topic describes how to define parameters of calls to help-handling functions and how these calls are executed.

11. Use Ctrl+Enter to open file in that line

Sometimes when we investigate C++ code we want to see other files included or mentioned there, for example if there is a line like this,

#include “Unit1.h”

move or position your cursor to between ” and ” then press Ctrl+Enter keys together, this will open the file between them.

12. How do I set up icons for my application?

An icon, in the computer world, is a pictogram or ideogram displayed on a computer screen in order to help the user navigate a computer system. The icon itself is a quickly comprehensible symbol of a software tool, function, or a data file, accessible on the system and is more like a traffic sign than a detailed illustration of the actual entity it represents.

In C++ Builder, every application build (debug or release) has a standard C++ application icon. If you are developing a great application, especially one for a commercial or professional market, you should also create and add a custom icon for your application rather than a stock generic one. Icons are really important, they really should be part of an overall branding strategy. The icon quickly becomes the initial ‘face’ of your app. Think of Twitter’s blue tweety bird of Facebook (Meta’s) stylized “F” and the brand recognition the color scheme and font choices they are associated with. If you can I highly recommend trying to find a reasonably-priced professional logo designer for your commercial applications. The relatively small financial outlay is easily offset by the boost in your potential user’s perception of the quality of your code. That said, you can create icons by yourself. You can change your application icon from the Project–>Options menu in the Application->Icons section as below.

13. Did you know you can compile C++ projects by using msbuild command in console/terminal window?

In some cases you may need to compile C++ Builder projects in a DOS-like command prompt or Powershell window. This allows you to build your applications without running the IDE. C++ project files are compatible files with the msbuild command. To use msbuild with your applications,

  1. Run RAD Studio Command Prompt,
  2. Go to your project folder by using cd commands,
  3. Type msbuild command with your <project file name> as in example below,
[crayon-673f7ff917420058074948/]

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.

Latest new posts, more examples and tutorials can be found in blogs.embarcadero.com and in LearnCPlusPlus.org, you can easily improve your C++ programming knowledge and skills with those modern examples

Exit mobile version