thecodex.expert · The Codex Family of Knowledge
C++

Setup and Compilers

A C++ feature being “in the standard” and being usable in your project are two different things — each compiler adopts new standard features at its own pace.

C++20 / C++23 GCC, Clang, or MSVC Last verified:
Canonical Definition

g++ (GCC's C++ front end) and Clang are both free, cross-platform, and available on Linux, macOS, and Windows; MSVC is Microsoft's own compiler, tightly integrated with Visual Studio and the primary choice on Windows. Each independently implements the ISO C++ standard, tracking their own compliance status pages, which means a specific new language feature can be available in one compiler well before another — checking a project's actual target compiler and version matters more in C++ than in languages with a single reference implementation.

Compiling and running by hand

The -std flag targets a specific standard version explicitly — without it, the compiler's default can vary by version, making builds less predictable across different machines and compiler updates.

C++terminal
$ g++ -std=c++23 -Wall -Wextra -o hello hello.cpp
$ ./hello
Hello, World!

$ clang++ -std=c++23 -o hello hello.cpp   // Clang works identically for this same source

Enabling warnings: genuinely essential in C++

-Wall -Wextra catches a meaningful class of real bugs before they ever run — an uninitialized member, a shadowed variable, a suspicious implicit conversion — all things C++'s permissive defaults would otherwise let compile silently.

C++terminal
$ g++ -std=c++23 -Wall -Wextra -Wpedantic -o app app.cpp
// -Wpedantic: warns about non-standard compiler extensions being used

Package management: no single official answer

Unlike languages with one dominant built-in package manager, C++ has several competing third-party solutions — vcpkg (Microsoft-backed) and Conan are the two most widely used today, each managing external library dependencies in a way C++ itself has no built-in mechanism for.

C++terminal
$ vcpkg install fmt      // one common option
$ conan install fmt/10.2.1   // another common option, different project

Sources

1
Free Software Foundation. C++ Standards Support in GCC, gcc.gnu.org/projects/cxx-status.html, and Clang C++ Status, clang.llvm.org/cxx_status.html.