Guide of Scifir

Complete guide of C++

2023-09-05 Ismael Correa C. start, informatics

History of C++

C++ has been created by Bjarne Stroustrup in 1981. It’s based on C, and for that reason his first name was “C with classes”. A class was then, and continues being, a data structure with functions that allow to customize how that data behaves. The first compiler is cfront, the currently being most used are g++ and clang++.

C++ has evolved over time and, then, has different versions available. The versions of C++ are C++98, C++03, C++11, C++14, C++17 and C++20.

Currently, C++ has an ISO, called International Standard ISO/IEC 14882:2020(E) – Programming Language C++, which is essentially the sintaxis of the programming language, not the compilers.

Bibliography

The most important book of C++ is “The C++ programming language”, from Bjarne Stroustrup.

Websites

Compiling system

GNU binutils

The GNU binutils are tools used to analize the files compiled and created with the build system. They allow to detect errors in the compiled files, and also they allow to study in detail assembler, the final programmin language in whih all C++ files are converted to by the compiling process.

C++ IDEs

Installing C++ tools

Linux

Install the packages, through apt or the package manager of your Linux distribution if it’s another. The packages you must install are the ones containing gcc, clang, make, cmake, autotools. Additoinally, you should add gtk, wxwidgets and qt.

Windows

Inside Windows use MinGW to install C++. There you can install the packages you need, like gcc, clang, make, cmake, autotools, gtk, wxwidgets and qt.

Build tools

make

cmake

To build using cmake type the following commands, in order:

cmake .
make
make install

When using cmake, you also have available ctest and cpack, explained bellow.

autotools

To build using autotools type the following commands, in order:

./configure
make
make install

ninja

The ninja build system uses a file called build.ninja. To build under ninja, just run ninja.

qmake

The qmake build system uses a file with .pro extension. To build under qmake use the following command, the example is for a file called hello.pro:

qmake -o Makefile hello.pro

An example of a qmake file is the following:

CONFIG += debug
HEADERS += hello.h
SOURCES += hello.cpp
SOURCES += main.cpp
win32 {
    SOURCES += hellowin.cpp
}
unix {
    SOURCES += hellounix.cpp
}

Eclipse internal builder

The IDE Eclipse has an internal builder for C++, which is possible to use in replacement of the other builders. That builder is configured in a window of the program for each project.

Sintaxis

Types

Literals

Testing

Packaging

Apart from packages there exist, for Windows, the installers.

Standard library

The most important headers of the standard library of C++ are the following:

Important libraries

Important libraries of C++ are the following:

For testing there exist the following libraries:

To use XML files inside C++ programs there are the following libraries:

To create GUI desktop programs the libraries are the following:

To work with fonts the following libraries are used:

To work with images the following libraries are important:

To work with 3D the following libraries are important:

To work inside Linux the following libraries are used:

The compression libraries to know about are the following:

The libraries through which compilers are made are the following: