Add return 0;
or a similar expression that returns an integer, to the end of your main(), and change main()
to int main()
, and I think you will find that the code works fine.
When no return type is specified for main(), it defaults to int. Furthermore, with the compiler flags you have enabled, not specifying a type for main() causes an error.