I was learning Adam Drozdek\'s book \"Data Structures and Algorithms in C++\", well, I typed the code in page 15 in my vim and compiled it in terminal of my Ubuntu 11.10.
Including:
int main() { //code return 0; }
will help you. This problem usually occurs to those who are learning from book in which they usually don't use main function after a few chapters.