First, install ncurses:
sudo apt-get install libncurses5-dev libncursesw5-dev
Then compile using:
g++ -o sudoku sudoku.cpp -lncurses
And run:
./sudoku