How to you set C++ to C++17 in replit

How do I set a repl to C++17?

Hey @Gowtham911!

We use Nix as our system-wide package manager. Currently, Nix only goes up to C++16.

To set up C++16 in a Repl, you can edit the nix channel property of the .replit file to stable-23_05 and set the package in replit.nix to clang_16:

Here is the ink to an example:

1 Like

To get clang to use C++ 17, add/change the -std flag in Makefile. You could do this by running in Shell:

sed -i '/override CXXFLAGS/s/-std=[^[:blank:]]+|$/-std=c++17/' Makefile

You could even change 17 to 2b (23).

1 Like