Reputation: 53
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?
Upvotes: 4
Views: 273
Reputation: 13023
You can use the -std flag. For example, to compile to C99, use -std=c99
The documentation for it is here
Upvotes: 7
Reputation:
Use the -std
flag like this:
g++ -std=c++98 -o myprog myprog.cpp -lfoo
Here is a man page with plenty of GCC/G++ options, including this one.
Upvotes: 5