Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile code to a specific C/C++ standard

Tags:

c++

c

g++

clang++

I have tried googling this but all I get is results on how to compile a basic program. Is it possible to compile code to a specific C++ standard using Clang++ and G++ by specifying that code should be compiled to say, C89, C99, C++98, etc?

like image 885
Terminator Avatar asked Dec 15 '22 16:12

Terminator


1 Answers

You can use the -std flag. For example, to compile to C99, use -std=c99

The documentation for it is here

like image 155
munk Avatar answered Jan 04 '23 07:01

munk