Skip to content
Sign upLog in
← Back to Community

How do I enable C++14, C++17, C++2a and switch compilers

Profile icon
hooddanielc

There are so many features not available in C++11. The latest version available is C++11. Also I don't see an option to choose the compiler. Is there a way to change clang to gcc?

Voters
Profile icon
pavi2410
Profile icon
antoinesavine
Profile icon
AriAri
Profile icon
a5rocks
Profile icon
hooddanielc
Comments
hotnewtop
Profile icon
jasonsun0310

why can't we have a button to choose the standard...

Profile icon
SPQR

Try using the shell as

@a5rocks
said. To save yourself the trouble of typing the whole command the whole time, make a blank file called main and fill the file with

g++ -std=c++17 *.cpp -o run.o chmod 744 /home/runner/run.o /home/runner/run.o

(g++ or gcc)
(-std=c++17 sets the language standard to C++17, you can change it to -std=c++14 etc to use C++14 or whatever else)
to run, open the shell and type bash main.

Profile icon
greggman

@SPQR
save yourself having to type bash and put #!/bin/sh at the top of main then chmod u+x main. from then on ./main 😅

Profile icon
[deleted]

oof

Profile icon
PedroSerra
Profile icon
a5rocks