Why am I getting compilation error in this?

Hi, I am getting compilation error in the code at the line where I am trying to stack.isEmpty() and stack.top().

I dont understand the reason behind this.