Libraries

Location
  1. Courses

    /

  2. Complete C++ Course

    /

  3. The basics

    /

  4. Libraries

The standard libraries

Both C and C++ have their own standard library. A standard library is a set of tools (Functions, macros, global variables and classes (C++ only)) that is included with every compiler. Each compiler provide their own implementation of the standard libraries. Therefore, even though the effects of the tools of the standard libraries are the same no matter what compiler is used, they will be coded differently. Using the standard libraries is recommended, because their implementations are (likely) efficient, stable (They should not make the program crash) and they are guaranteed to be implemented on every compiler (Will work on all systems where a C/C++ compiler is available).

Operating system libraries

Operating systems have their own library that allow programmers to access their functionalities. To manipulates things that are managed by the operating system (File systems, network communications, windows, play sounds...), we must interact with it. The advantage of using the library of an operating system (OS) directly is that we have access to all the functionalities of the OS. The inconvenient is that we will not be able to compile the same code for systems using other operating systems. Implementations of the standard libraries use the library of the operating system it is made for when it needs to access resources managed by the OS (Example: Print and read from the console).

Other libraries

We can use other libraries (That can be made by individuals, organizations, companies...) to access functionalities not provided by the standard libraries. The advantage of using that kind of libraries over libraries of operating systems, is that they are often implemented (therefore work) on many systems. The way such libraries work on many different operating systems is that a version of the sections of code that interact with the operating system is made for each supported operating system. Like with the C/C++ Standard Libraries, this is not visible from the perspective of the user. The interface remains the same no matter the operating system and therefore the same code can be compiled on all the supported systems (As long as the library is installed).

On this website, courses on some libraries, like those, are available. For example, there are courses teaching how to use the C library SDL and the C++ library SFML to develop graphical applications on Windows, GNU/Linux, Mac, Android and iOS.