Home C++ Introduction Decisions Loops Input/Output Functions Stack and Heap References Arrays Searching and Sorting Recursion Pointers Character and Strings Structures Classes Inheritance Exceptions Templatess STL Modern C++ Misc Books ----

Modern C++


C++ 11
C++ 14
C++ 17
C++ 20
C++ 23

g++ version

We can find out the g++ version with the command:

$ g++ --version
g++ (GCC) 13.4.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However that does not give the C++ version that the default
g++ is running on.

We can find that out by running the following program.

File: version1.cpp
#include <iostream>

int main()
 {
    std::cout << __cplusplus << std::endl;
    return 0;
}

$ g++ version1.cpp ; ./a.exe
201703

If we want to specify that the "g++" run with a
particular version then we can use the command:

$ g++ -std=c++11 version1.cpp ; ./a.exe
201103

We can use the below link to see how the compiler
is going to act.

https://cppinsights.io/


The below link has a good summary of the new features
in different C++ versions.

https://github.com/AnthonyCalandra/modern-cpp-features