Ask coding questions

← Back to all posts
How do I enable C++14, C++17, C++2a and switch compilers
hooddanielc (1)

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?

Commentshotnewtop
SPQR (431)

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.

greggman (0)

@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 😅