The C++ programming language is one of the most popular programming languages. C++ is the highly evolved and modern app building software comes with a lot of libraries and with header files to define functions in these libraries. Libraries are one of the main important parts of the C and C++ languages. For example, you can use
<stdio.h> library – or
<cstdio> in C++ – for the standard input output functions. You can use all C functions included in this library, i.e.
getchar, and many C functions in your C or C++ applications, although the safer and more modern C++ versions in the
<iostream> header are recommended.
Today, you can develop C console apps or full GUI C++ apps with modern libraries, including database connections, 2D-3D visualizations, you can use artificial Intelligence libraries like machine learning, deep learning libraries and more. Libraries are also used in C++. Do you know that C libraries can be used in C++ applications too? There are very modern libraries with GUIs like VCL (
vcl.h) and FMX (
fmx.h) libraries in C++ Builder. The latest C++ Builder can be used to develop these kinds of apps in Windows 11, including x86, x64, and mobile device operating systems. You can add modern GUIs with styled skins, and produce apps which apply effects to digital images easily for example sepia effects, glow effects, etc. The C programming language can be used to develop apps with C or C++ SDKs and with free tools like Dev-C++ and C++ Builder Community Edition.
Table of Contents
What happens when a C or C++ program works with libraries?
When we develop an application in the C or C++ language, we often need to use pre-defined variables and functions to do different operations. For all these, generally, we need to include standard libraries that have these pre-defined variables and functions. Each library in the C or C++ language includes functions and definitions for commonly used purposes such as file or stream handling, memory management and so on.
Libraries in C and C++ programming are pre-compiled files that are mostly included in the lib (library) folder, ready to be linked into your app. Generally, their extension is
*.a. Libraries can also be external in the form of a dynamically linked library (DLL) which is loaded when you app is initialised. Libraries use a collection of header files that include these pre-defined variables and functions. Header files (*.h files in C and *.h , *.hpp files in C++). Libraries may require many header files, for example, the VCL and FMX libraries of C++ Builder are huge libraries, and they include many header files to enable our programs to create, display, and use a GUI-based user interface.
By referencing the library’s functions using the header file we are telling the compiler and linker that the library’s code will be accessed by our own program code. The header files are a contract, if you like, saying what parameters the library’s functions are expecting, their types and even the way the compiler should attempt to call or link to the functions and code in the library.
Here are some library types that we use in C and C++ programming.
- Secure C Library
- Default Run-time Libraries
- Static Run-time Libraries
- Dynamic-link Libraries (DLL)
- Custom User Defined Libraries
Moreover, there are many libraries that can help you to develop your apps easier and faster, for example you can also check these below,
Libraries are very important and standard libraries exist for standard input and output functions, math functions, string handling functions, time manipulation functions, etc. We may use libraries in our own applications to split up our apps into modules. These pieces make them easier to understand, test, and debug, and also make it possible to reuse code from other applications that we develop.
How a classic C program works with libraries
In C programming there are many useful functions that require libraries and their headers. Here are 3 examples of the most commonly used C libraries,
getchar();and many I/O functions are defined in
>header and declared in its library
strlen();and many string functions are defined in
<string.h>header and declared in its library
- sin(), tan(), rand(); pow(); and many math functions are defined in
<math.h>header and declared in its library
The libraries which are frequently used in most program types are combined in the C Runtime Library (RTL). All the headers and details of the C Runtime library can be found here. You can see all functions when you enter these headers.
Here is an example to how to use the
printf function to print text output in C language. Note that we include
<stdio.h> to use this
How C++ works with libraries? What is a library?
C++ also uses libraries. It uses standard C libraries and also modernized C++ libraries which are being updated in CLANG standards (C++98, C++11, C++14, C++17, C++20). RAD Studio / C++ Builder supports CLANG standards and has several thousand functions, macros, and classes that you call from within your C and C++ programs to perform a wide variety of tasks, including low- and high-level I/O, string and file manipulation, memory allocation, process control, data conversion, mathematical calculations, and more.
How C++ Builder works with libraries
C++ Builder is the easiest and fastest C and C++ IDE for building everything from simple to large-scale 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. 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 library for high-performance native Windows apps and the powerful FireMonkey (FMX) framework library for cross-platform UIs. There is a free C++ Builder Community Edition for students, beginners, and startups.
The C language is supported by the latest modern C++ IDE’s and compilers. One of the most powerful, yet easy to use, is C++ Builder. Here are some great library examples that can be used in C++ Builder,
- Run-Time Library (RTL) is a procedural library shared by Delphi and C++ for multi-device apps including Windows, iOS, Android
- Visual Component Library (VCL) is an object hierarchy of visual components that are supported on Windows only (in Win32 and Win64 applications).
- FireMonkey Library (FMX) is a visual component library with sophisticated graphics, animation, and styling capabilities
- Boost Libraries are a set of C++ libraries that significantly expand the language using template metaprogramming. This version (1.39) is for the classic toolchain for Win32 only. Use Boost 1.70 for the modern Win32 and Win64 Clang-enhanced platforms.
- Eigen Library is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms
- IPWorks is a comprehensive framework of easy-to-use components for Internet development, including FTP, HTTP, SMTP, POP, IMAP, LDAP, DNS, SMS, SOAP, etc.
- The JEDI Code Library (JCL) consists of a set of thoroughly tested and fully documented utility functions and non-visual classes
- TMS Software Components are visual components for VCL, FMX, LCL, FNC, ASP.NET, .NET, IntraWeb applications.
- DEVART Components includes database management software and ALM solutions for the most popular database servers.
- ESEGECE Components provides connection components for Delphi, CBuilder, and .NET developers
- MITOV Software Components provides high performance software and Data Flow solutions in various areas.
What is the Run Time Library (RTL)?
The Run-Time Library (RTL) is a procedural library shared by Delphi and C++ for any supported target platform. The RTL is made up of the members of the
System.Classes units. RTL Run Time Library is one of the most used libraries in C++ Builder. It has many standard libraries and headers. Mainly there is Windows C/C++ RTL for the Windows 32bit/64bit applications. There are macOS C/C++ RTL, see MacOS C RTL. For iOS C/C++ RTL, see iOS C RTL.
Most of the standard library headers like
math.h are included in RTL library. More details about C Run Time Library can be found here: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/C_Run-Time_Library_Reference
What is the Visual Component Library (VCL)?
The Visual Component Library (VCL) is an object hierarchy of visual components that are supported on Windows only (in Win32 and Win64 applications). The Visual Component Library (VCL) provides a set of visual components for the rapid development of Windows applications in the Delphi and C++ languages. VCL contains a wide variety of visual, non-visual, and utility classes for tasks such as building Windows applications, web applications, database applications, and console applications.
VCL is an acronym for the Visual Component Library, a set of visual components for rapid development of Windows applications in the Delphi and C++ Builder. The VCL contains a wide variety of visual, non-visual, and utility classes for tasks such as Windows application building, web applications, database applications, and console applications. All classes descend from
TObject introduces methods that implement fundamental behavior like construction, destruction, and message handling.
Components are a subset of the component library that descend from the class
TComponent. You can place components on a form or data module and manipulate them at design time. Using the Object Inspector, you can assign property values without writing code. Most components are either visual or nonvisual, depending on whether they are visible at run time. Some components appear on the Component Palette.
The VCL library comes with many amazing visual styles for the UI elements. Here are the examples of two of many styles in VCL,
What is the FireMonkey Library (FMX)?
The FireMonkey Library (FMX) is a visual component library with sophisticated graphics, animation, and styling capabilities. You can create FireMonkey applications for any supported target platform. FireMonkey Library (FMX) leverages the graphics processing unit (GPU) in modern desktop and mobile devices to create visually engaging applications on multiple platforms, targeting the entire range from the personal to the enterprise.
What does a ‘framework’ mean in C++ programming?
Frameworks are actually libraries that holds a lot of libraries including visual libraries. VCL and FMX are also called as frameworks. They both have visual and non-visual components that can be used in GUI applications.
What visual components can be found in the VCL and FMX libraries?
Visual components, such as
TSpeedButton, are called controls and descend from
TControl. Controls are used in GUI applications and appear to the user at run time.
TControl provides properties that specify the visual attributes of controls, such as their height and width.
What non-visual components are there in the VCL and FMX libraries?
Nonvisual components are used for a variety of tasks. For example, if you are writing an application that connects to a database, you can place a
TDataSource component on a form to connect a control and a dataset used by the control. This connection is not visible to the user, so
TDataSource is nonvisual. At designtime, nonvisual components are represented by an icon. This allows you to manipulate their properties and events just as you
What do the other VCL and FMX classes do?
Classes that are not components (that is, classes that descend from
TObject but not
TComponent) are also used for a variety of tasks. Typically, these classes are used for accessing system objects (such as a file or the clipboard) or for transient tasks (such as storing data in a list). You cannot create instances of these classes at design time, although they are sometimes created by the components that you add in the Form Designer.
What other functionality can we add to our C++ programs with libraries?
Other popular C++ Libraries that can be used in different C++ compilers around the world are,
- OpenCV, or Open-Source Computer Vision Library, is a computer vision and machine learning library written natively in C++, and available under an Apache 2 license
- GTK is a free and open-source cross-platform widget toolkit for creating graphical user interfaces
- Active Template Library (ATL) for for building COM (Common Object Model) objects, available with Visual Studio
- Cinder Library, for applications such as audio, computational geometry, graphics, and video
- FloatX is low-precision, floating point type emulation, there is Float eXtended library too.
- Poco (Portable Components) C++ Libraries are cross-platform C++ libraries for building Internet and network applications
- Velox is an embeddable, vectorized execution library for OLAP system
- Asio C++ library for network and low-level I/O programming,
- Wt is web GUI library in modern C++ that allows developers to build interactive web UIs with widgets
C++ world is really huge with a lot of libraries, most are free to use under some licenses. More library examples can be found here
How to download C++ Builder program to work with libraries?
In 2022, Embarcadero announced the RAD Studio and C++ Builder 11.2. C++ Builder 11.2 contains a number of improvements and quality fixes for C++ developers using C++Builder and RAD Studio 11.1, including performance improvements, display of code completion results, improved navigation, as well as a variety of quality fixes including resolving an issue for users of the classic compiler, issues saving all files in a project, and more. There are also several new features, including handling multiple navigation destinations when Control-clicking on an identifier, delayed indexing to reduce CPU usage, and a third option for LSP Code Insight behavior which indexes all files in all projects. We recommend reading the What’s New in RADS 11.2 in order to tune its behavior for your projects and needs.
RAD Studio 11.2 versions are introduced several new features, enhancements, and quality updates in key areas including:
- Provision apps for Windows 11
- C++Builder CodeInsight Update
- More Powerful Compilers And Debuggers
- Improved Code Insight!
- Support for Android API Level 32
- Compile for macOS M-series (Apple Silicon) processors
- New & modernized VCL components
- Use enhanced remote desktop support to collaborate remotely
- High-DPI designers for VCL and FireMonkey
- IDE Support for Markdown, VCL-Based HTML preview
- IDE Supports high-DPI 4K+ Screens
- Many Quality Improvements And Bug Fixes
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder.
Please visit https://www.embarcadero.com/products/cbuilder.