Since other answers have covered why you are getting an error, here is a way to move in one of the four directions in response to a key press: use lookup tables instead of the conditionals/switches.
Setup portion:
std::map > moves;
moves[up_key] = make_pair(0, -1);
moves[down_key] = make_pair(0, 1);
moves[left_key] = make_pair(-1, 0);
moves[right_key] = make_pair(1, 0);
The function:
bool Character::keyPress(char c) {
if (moves.count(c)) {
pair dir = moves[c];
move(dir.first, dir.second);
return true;
} else {
return false;
}
}