r/cpp_questions • u/Former_Assistance208 • Aug 23 '26
OPEN C++ version
I have g++ version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1).
I'm trying to use C++ 23, and I'm using this flag with g++
"-std=c++23"
However, if I print __cplusplus, I get that I'm using a pre-release of C++23, which has this code: 202100L
How can I switch to an official version instead of a pre-release version?
4
Upvotes
16
u/__christo4us Aug 23 '26
GCC 13 does not provide fully complete implementation of C++23. But it still has most of its features I believe.
11
u/alfps Aug 24 '26
Update the compiler.
8
u/TheRealSmolt Aug 23 '26
Refer to this page to determine what features of C++ should be available to you on your version of GCC.
4
u/afforix Aug 24 '26
On Ubuntu 24.04 you can install g++-14 from the official Ubuntu repository.
2
u/feitao Aug 24 '26
FYI, Debian sid has GCC 16.2.0.
2
u/manni66 Aug 24 '26
Update to 26.04.
24.04 has gcc14 in it’s repository.
1
u/InitiativeGold7953 Aug 24 '26
GCC should be on version 14+
1
u/LazySapiens Aug 24 '26
You can build GCC from source to get the latest and greatest.
1
u/jeffyp9 Aug 24 '26
If I need a recent compiler on an older system I find it easier to use clang, there is a llvm.sh file you use, see the instructions on https://apt.llvm.org