You have put your main()
function in the standard
namespace. That's not the entry point of your program. The entry point of your program should be in the global namespace.
Per paragraph 3.6.1/1 of the C++11 Standard:
A program shall contain a global function called
main
, which is the designated start of the program. It is implementation-defined whether a program in a freestanding environment is required to define a main function.
To fix the problem, just move your main()
to the global namespace. Also notice, that return 0
is not necessary. Flowing off the end of main()
is equivalent to returning 0.