I am working on a project for one of the classes on Udemy.com and keep getting this error;
/home/scott/bullcowgame/src/main.cc:40:3: error: ‘constexpr’ was not declared in this scope /home/scott/bullcowgame/src/main.cc:40:13: error: expected ‘;’ before ‘int’ /home/scott/bullcowgame/src/main.cc:42:35: error: ‘WORD_LENGTH’ was not declared in this scope
this is my code
#include <iostream> #include <string> using namespace std; void PrintIntro(); string GetGuessAndPrintBack(); // the entry point for our application int main() { PrintIntro(); GetGuessAndPrintBack(); GetGuessAndPrintBack(); cout << endl; return 0; } // introduce the game void PrintIntro() { constexpr int WORD_LENGTH = 9; cout << "Welcome to Bulls and Cows, a fun word game.\n"; cout << "Can you guess the " << WORD_LENGTH; cout << " letter isogram I'm thinking of?\n"; cout << endl; return; } // get a guess from the player string GetGuessAndPrintBack() { cout << "Enter your guess: "; string Guess = ""; getline(cin, Guess); // print the guess back cout << "Your guess was: " << Guess << endl; return Guess; } I am using the Anjuta IDE
‘constexpr’ was not declared in this scope. Compile with C++11 enabled.