user9391741
user9391741

Reputation:

Which C++ standard for I have for g++ compiler?

I work on the Code::Blocks IDE but I'm currently planning to use Sublime editor + some compiler.

In C: B, I have the MinGW g++ compiler (not sure of the version).

How do I know which C++ standard (14 or 11 or the previous ones) I'm using? Also, how do I change the C++ standard and get the one I want? (I need 14 actually). Please tell for both C::B and when I'm installing the compiler separately for Sublime.

Upvotes: 2

Views: 146

Answers (1)

eesiraed
eesiraed

Reputation: 4654

C++14 should be the default for GCC since version 6.0. Before 6.0, the default is C++98. Open a command prompt and type g++ --version to see your version.

To change the version flag, go to Settings -> Compiler (or something like that) and look at the list of compiler flags. Check the one that looks like "Have g++ follow the ISO ... C++14 standard".

For other IDEs, find the compiler/build settings, which might or might not be separate for each project, look through them, and select the standard. The flag for it is --std=c++14 by the way.

This might help.

Upvotes: 1

Related Questions