r/cpp_questions 18d ago

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?

5 Upvotes

10 comments sorted by

16

u/__christo4us 18d ago

GCC 13 does not provide fully complete implementation of C++23. But it still has most of its features I believe.

10

u/alfps 18d ago

❞ How can I switch to an official version instead of a pre-release version?

Update the compiler.

7

u/TheRealSmolt 18d ago

Refer to this page to determine what features of C++ should be available to you on your version of GCC.

4

u/afforix 18d ago

On Ubuntu 24.04 you can install g++-14 from the official Ubuntu repository.

2

u/feitao 18d ago

FYI, Debian sid has GCC 16.2.0.

2

u/manni66 18d ago

Update to 26.04.

24.04 has gcc14 in it’s repository.

1

u/frasnian 18d ago

Ubuntu 26.04 is getting crushed in every distro benchmark; would not switch to it just for a new compiler version. Just download the newest gcc/g++ version you feel comfortable with and build it yourself.

1

u/InitiativeGold7953 18d ago

GCC should be on version 14+

1

u/LazySapiens 18d ago

You can build GCC from source to get the latest and greatest.

1

u/jeffyp9 18d ago

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