Dev C%2b%2b Header Files List

< C++ Programming

Libraries[edit]

C Header Files and Standard Functions (This info is taken from Appendix C of the nice book Data Abstraction and Problem Solving with C, 3rd ed., by F. Prichard.) Here is a list of commonly used C headers. If an older version of the header exists, its name is shown in parentheses. Cassert (assert.h). A 'source file' can be any file, with a name of any form, but is most commonly named with a '.h' extension and called a 'header file' (sometimes '.hpp' or '.hh' to distinguish C headers), though files with.c,.cc, and.cpp extensions may also be included (particularly in the Single Compilation Unit technique), and sometimes other extensions. This is the directory that contains the pre-compiled library files (.lib): Library files. Enter library filenames in additional dependencies for the libraries to use: Some libraries (such as e.g. Boost) use auto-linking to automate the process of selecting library files for linking, based on which header-files are included. Manual selection of.

Putting class definitions in a header file. In the lesson on header files, you learned that you can put function declarations inside header files in order to use those functions in multiple files or even multiple projects. Classes are no different. Class definitions can be put in header files in order to facilitate reuse in multiple files. Next: Once-Only Headers, Previous: Include Operation, Up: Header Files 2.3 Search Path By default, the preprocessor looks for header files included by the quote form of the directive #include ' file ' first relative to the directory of the current file, and then in a preconfigured list of standard system directories. Getting Dev-C The author has released Dev-C as free software (under GPL) but also offers a CD for purchase which can contain all Bloodshed software (it's customizable), including Dev-C with all updates/patches. Link to Bloodshed Dev-C for a list of Dev-C download sites.

Libraries allow existing code to be reused in a program. Libraries are like programs except that instead of relying on main() to do the work you call the specific functions provided by the library to do the work. Functions provide the interface between the program being written and the library being used. This interface is called Application Programming Interface or API.

Libraries should and tend to be domain specific as to permit greater mobility across applications, and provide extended specialization.Libraries that are not, are often header only distribution, intended for static linking as to permit the compiler and the application, only to use the needed bits of code.

What is an API?

To a programmer, an operating system is defined by its API. API stands for Application Programming Interface. An API encompasses all the function calls that an application program can communicate with the hardware or the operating system, or any other application that provides a set of interfaces to the programmer (i.e.: a library), as well as definitions of associated data types and structures. Most APIs are defined on the application Software Development Kit (SDK) for program development.

In simple terms the API can be considered as the interface through which the user (or user programs) will be able interact with the operating system, hardware or other programs to make them to perform a task that may also result in obtaining a result message.

Can an API be called a framework?

No, a framework may provide an API, but a framework is more than a simple API. By default a framework also defines how the code is written, it is a set of solutions, even classes, that as a group addresses the handling of a limited set of related problems and provides not only an API but a default functionality, well designed frameworks enable its interchangeability for a similar framework, striving to provides the same API.

As seen in the File organization Section, compiled libraries consists in C++ headers files that are included by the preprocessor and binary library files which are used by the linker to generate the resulting compilation. For a dynamically linked library, only the loading code is added to the compilation that uses them, the actual loading of the library is done in the memory at run-time.

Programs can make use of libraries in two forms, as static or dynamic depending on how the programmer decides to distribute its code or even due to the licensing used by third party libraries, the static and dynamic libraries section of this book will cover in depth this subject.

Note:
As we will see when covering multi-threading when selecting libraries. Remember to verify if they conform to the your requirements on that area.

Third party libraries[edit]

Additional functionality that goes beyond the standard libraries (like garbage collection) are available (often free) by third party libraries, but remember that third party libraries do not necessarily provide the same ubiquitous cross-platform functionality or an API style conformant with as standard libraries. The main motivation for their existence is for preventing one tho reinvent the wheel and to make efforts converge; too much energy has been spent by generations of programmers to write safe and 'portable' code.

There are several libraries a programmer is expected to know about or have at least a passing idea of what they are. Time, consistency and extended references will make a few libraries pop-out from the rest. One notable example is the highly respected collection of Boost libraries that we will examine ahead.

Licensing on third party libraries

The programmer may also be limited by the requirements of the license used on external libraries that he has no direct control, for instance the use of the GNU General Public License (GNU GPL) code in closed source applications isn't permitted to address this issue the FSF provides an alternative in the form of the GNU LGPL license that permits such uses but only in the dynamically linked form, this is mirrored by several other legal requirements a programmer must attend and comply to.

Libraries come in two forms, either in source form or in compiled/binary form. Libraries in source-form must first be compiled before they can be included in another project. This will transform the libraries' cpp-files into a lib-file. If a program must be recompiled to run with a new version of a library, but does not need any further changes, the library is said to be source compatible. If a program does not need to be modified and recompiled to use a new version of a library, the library is then classified as being binary compatible.

Static and Dynamic Libraries[edit]

To do:
define 'static library' and 'dynamic library' and 'static binary' here

Advantages of using static binaries:

  • Simplification of program distribution (fewer files).
  • Code simplification (no version checks as required in dynamic libraries).
  • Will only compile the code that is used.

Disadvantages of using static binaries:

  • Waste of resources: Generates larger binaries, since the library is compiled into the executable. Wastes memory as the library cannot be shared (in memory) between processes (depending on the operating system).
  • Program will not benefit from bug fixes or extensions in the libraries without being recompiled.
Binary/Source Compatibility of libraries

A library is said to be binary compatible if the program that dynamically links to an earlier version of that library, continues to work using another versions of the same library. If a recompilation of the program is needed for it to run with each new version the library is said to be source compatible.

Producing binary compatible libraries is beneficial for distribution but harder to maintain by the programmer. It is often seen as a better solution to do static linking, if the library is only source compatible, since it will not cause problems to the end-user.

Binary compatibility saves a lot of trouble and is a signal that the library reached a status of stability. It makes it easier to distribute software for a certain platform. Without ensuring binary compatibility between releases, people will be forced to offer statically linked binaries.

header-only libraries

Another distinction that is commonly made about libraries are on how they are distributed (regarding structure and use). A library that is contained only on header files is considered header-only library. Often this means that they are simpler and easy to use, however this will not be the ideal solution for complex code, it will not only hamper readability but result in larger compile times. Also depending on the compiler and it's optimizing capabilities (or options) can, due to the resulting inlining, generate larger binaries. This may not be as important in libraries mostly implemented with templates. Header-only libraries will always contain the source code to the implementation, commercial is rare.

Example: Configuring MS Visual C++ to use external libraries[edit]

The Boost library is used as example library.

Note:
Boost.org has a install guide named Getting Started on Windows, that points to an automatic installed provided by BoostPro Computing (commonly supporting the previous and older release versions), noting also that if used with the option “Source and Documentation” deselected (selected by default), it will not show the libs/ subdirectory. This will disable the user from rebuilding part of the libraries that aren't only header files. This makes installing it yourself as shown in this section the best option.

Considering you already have decompressed and have the binary part of the Boost library built. There the steps which have to be performed:

Include directory[edit]

Set up the include directory. This is the directory that contains the header files (.h/hpp), which describes the library interface:

Library directory[edit]

Set up the library directory. This is the directory that contains the pre-compiled library files (.lib):

Library files[edit]

Dev c 2b 2b header files list folder

Dev C 2b 2b Header Files List Folder

Enter library filenames in additional dependencies for the libraries to use:


Some libraries (such as e.g. Boost) use auto-linking to automate the process of selecting library files for linking, based on which header-files are included. Manual selection of library filenames are not required for such libraries if your compiler supports auto-linking.

Dynamic libraries[edit]

In case of dynamically loaded (.dll) libraries, one also has to place the DLL-files either in the same folder as the executable, or in the system PATH.

Run-time library[edit]

The libraries also have to be compiled with the same run-time library as the one used in your project. Many libraries therefore come in different editions, depending on whether they are compiled for single- or multi-threaded runtime and debug or release runtime, as well as whether they contain debug symbols or not.

Retrieved from 'https://en.wikibooks.org/w/index.php?title=C%2B%2B_Programming/Compiler/Linker/Libraries&oldid=3223606'

Linked list is one of the most important data structures. We often face situations, where the data is dynamic in nature and number of data can’t be predicted or the number of data keeps changing during program execution. Linked lists are very useful in this type of situations.

The implementation of a linked list in C++ is done using pointers. You can go through the pointers chapter if you don’t have a strong grip over it. You can also practice a good number of questions from practice section.

A linked list is made up of many nodes which are connected in nature. Every node is mainly divided into two parts, one part holds the data and the other part is connected to a different node. It is similar to the picture given below.

Here, each node contains a data member (the upper part of the picture) and link to another node(lower part of the picture).

Notice that the last node doesn’t point to any other node and just stores NULL.

In C++, we achieve this functionality by using structures and pointers. Each structure represents a node having some data and also a pointer to another structure of the same kind. This pointer holds the address of the next node and creates the link between two nodes. So, the structure is something like:

The first data member of the structure (named node) is an integer to hold an integer and the second data member is the pointer to a node (same structure). This means that the second data member holds the address of the next node and in this way, every node is connected as represented in the picture above.

Dev C 2b 2b Header Files Listed

The picture representing the above structure is given below.

And the picture representing the linked list is:

So, if we have access to the first node then we can access any node of the linked list. For example, if ‘a’ is a node then a->next is the node next to the ‘a’ (the pointer storing the address of the next node is named ‘next’).

One thing you should notice here is that we can easily access the next node but there is no way of accessing the previous node and this is the limitation of singly linked list.

Coding up a linked list

You are now clear with the concepts of a linked list. Let’s code it up. The first part is to create a node (structure).

Now, we will create a class ‘linked_list’ which will contain all the functions and data members required for a linked list. This class will use the structure ‘node’ for the creation of the linked list.

The second and the most important part of a linked list is to always keep the track of the first node because access to the first node means access to the entire list. So, let’s call our first node as ‘ head’.

We have made two nodes – head and tail. We will store the first node in ‘head’ and the last node in ‘tail’. The constructor of the linked list is making both ‘head ’ and ‘ tail’ NULL because we have not yet added any element to our linked list and thus both are NULL.

Dev C 2b 2b Header Files List Windows 10

Now, let’s create a function of adding a node to our linked list.

If you are not familiar with the ‘malloc’ function, then just read the dynamic memory allocation chapter.

node *tmp=new node – We are allocating the space required for a node by the new operator. Now, ‘tmp’ points to a node (or space allocated for the node).

tmp->data = n – We are giving a value to the ‘data’ of ‘tmp’ as passed to the function.

tmp->next=NULL – We have given the value to ‘data’ in the previous line and a value of the pointer ‘next’ (NULL) in this line and thus making our node ‘tmp’ complete.

The next part after the creation of a node is to join the nodes and create the linked list. We will first check if the ‘head’ is NULL or not. If the ‘head’ is NULL, it means that there is no linked list yet and our current node(tmp) will be the ‘head’.

if(head NULL)
{
head = tmp;
tail = tmp;
}

Dev C 2b 2b Header Files Lists

If ‘head’ is NULL, our current node (tmp) is the first node of the linked list and this it will be ‘head’ and ‘tail’ both (as it is also the last element right now).

C%2b%2b

If ‘head’ is not NULL, it means that we have a linked list and we just have to add the node at the end of the linked list.

else
{
tail->next = tmp;
tail = tail->next;
}

The new node (tmp) will go after the ‘tail’ and then we are changing the tail because the new node is the new ‘tail’.

Try to understand the code by allocating two to three nodes by above mechanism and you will get it.

Next: