I figured it out. I wasn't including /wp-includes/functions.php in the file where the function was located.
When I figured that out, I got another error: Fatal error: Call to a member function main() on a non-object
It took me 2 hours to figure that one out. The problem was something like this:
I was including functions.php in example.php and then including example.php in options_menu.php. So in options_menu.php, the include statement was in the body section of the page which cause the error.
Long story short, include the functions file within the necessary function rather than at the file level!