# Existence of solution to maximization problem

I'm a first year Finance grad student and we're learning utility maximization problem now. We have been assuming that a solution to these problems exists. Are there any general theorem about the existence of maximization solution on $\mathbb{R}^n$? I have encountered once that "A utility maximization problem with a continuous utility function on a compact set has solution". Thanks in advance!