So I was trying to learn Enum classes. I copied this piece of code into my compiler:
#include <iostream>
using namespace std;
int main()
{
enum class Color
{
RED,
BLUE
};
Color color = Color::RED;
if (color == Color::RED)
cout << "The color is red!\n";
else if (color == Color::BLUE)
cout << "The color is blue!\n";
return 0;
}
I expect the code to print out "The Color is red!" However, my compiler gives this error:
warning: scoped enums only available with -std=c++11 or -std=gnu+11
and
error:'Color' is not a class or namespace
I'm currently using Dev-C++5.11. Any idea how to fix this?
Aucun commentaire:
Enregistrer un commentaire