for linux:
 g++ -std=c++11 8puzzle.cpp
  for mac g++ 8puzzle.cpp

wrote and tested on OSX yosemite