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

What Are Header Files In C++ and C Programming?

C and C++ languages are highly evolved and modern app-building software comes with a lot of libraries and with header files to define functions in these libraries. Header files and their libraries are one of the main important parts of the C and C++ languages. A header file can be added to code lines by using the #include <...> directive in a C++ code editor. For example, you can use <stdio.h> library header- or <cstdio> header in C++ – for the standard input/output functions. You can use all C functions included in this library header, i.e. printf, gets, sscanf, 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.

Can you use C header files in C++ programs?

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 library headers can be used in C++ applications too, but there are modernized versions of them which are highly recommended to be used in C++ projects. There are very modern library headers with GUIs like VCL (vcl.h) and FMX (fmx.h) library headers in C++ Builder.

The C++ programming language is one of the most popular programming languages. 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.

What Are Header Files In C++ and C Programming A C++ Header file
An example of a C++ header file

What are header files in C++ and C programming? What is a header file?

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.

Header files (*.h files in C and *.h , *.hpp files in C++) are the set of predefined library function definitions, data type definitions, macros, constants, classes, objects of classes, sometimes they have important reminder lines about the usage of library commands. A header file can be added in code lines by using #include <...> directive. For example, we can use <stdio.h> header file as below,

Here the #include directive tells the C or C++ preprocessor to include the contents of the header file specified in codes to the compiler and then continue with the rest of the original file. In another word, these preprocessor directives are used for instructing compiler that these header files need to be processed before compilation. Thus, by including these kind of header files, we can use its contents (functions, datatypes, macros, methods, classes, objects, constants) in our program.

In C++ standard header files don’t have extensions, For example, you can use <iostream> header file header as below,

What are the libraries of header files in C++ and C programming? What is a library?

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 *.lib. or *.a. Libraries can also be external in the form of a dynamically linked library (DLL) which is loaded when you app is initialized. Libraries use a collection of header files that include these pre-defined variables and functions. 

Some libraries may be comprised of 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.

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.

What are the classic header files in C programming?

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,

  • printf(); scanf(); gets(); getchar(); and many I/O functions are defined in <stdio.h> header and declared in its library
  • strcpy(); strstr(); 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> header to use this printf()function.

What are the classic header files in C++ programming?

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.

Here is an example to how to use the cout method to print text output in C++ language. Note that we include <iostream> header to use this cout method.

What are the most used header files in C++ programming with C++ Builder?

What Are Header Files In C++ and C Programming the C++ Builder logo

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 (VCL.h) for high-performance native Windows apps and the powerful FireMonkey (FMX.h) 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 are the Run Time Library Headers (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 SystemSystem.SysUtils, System.IOUtils, and 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 stdio.h, string.h, math.h are included in RTL library. Here are the list of C and C++ header files listed in RTL,

C

In parentheses are indicated the C++ headers:

C99

C++

  • bitset.h
  • deque.h
  • fstream.h
  • function.h
  • iomanip.h
  • ios.h
  • iosfwd.h
  • iostream.h
  • istream.h
  • iterator.h
  • locale.h
  • new.h
  • numeric.h
  • memory.h
  • ostream.h
  • set.h
  • stack.h
  • stdexcept.h
  • streambu.h
  • strstrea.h
  • valarray.h
  • vector.h
  • typeinfo.h

STL

  • hash_map.h
  • hash_set.h
  • queue.h
  • list.h
  • rope.h
  • slist.h
  • utility.h

C++Builder

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 header (VCL.h)?

simplepaint 4200797

The Visual Component Library (VCL) is an object hierarchy of visual components that are supported on Windows only (in Win32 and Win64 applications) and it can be used by including its <VCL.h> header. 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. If you create a new Windows application in C++ Builder, it will be automatically added in your code lines.

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. 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 Are Header Files In C++ and C Programming A dark mode theme screenshot
Mine Shaft
What Are Header Files In C++ and C Programming A light mode screenshot
Polar Light

What is the FireMonkey Library header (FMX.h)?

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. FMX Library can be used in C++ Builder by including its <FMX.h> header. If you create a new Multi-Device application in C++ Builder, it will be automatically added in your code lines.

What Are Header Files In C++ and C Programming An example of the Sepia effect
You can use FMX library to add Sephia Effect as in this photography by Yilmaz Yoru

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.

2022 10 06 20 54 25 8883822
There are many visual and non visual components and classes in the VCL and FMX

What visual components can be found in the VCL and FMX libraries and header files?

Visual components, such as TForm and 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 and header files?

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 use RTL, VCL, FMX header files and libraries in C++ programming?

cbuilder 11 512x5121x 6842885 6973897 3833518

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.

What Are Header Files In C++ and C Programming the RAD Studio screen
RAD Studio C++ Builder Welcome Screen

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

cbuilder 11 512x5121x 6842885


You can download the free C++ Builder Community Edition

Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder.

Please visit https://www.embarcadero.com/products/cbuilder.

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

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

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

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

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

How To Learn The Move Constructors In Modern C++?