Two main functions
Can we have two main() functions in a C++ program? The standard explicitly says in 3.6.1: A program shall contain a global function called main, which is the designated start of the program. [...] This function shall not be overloaded. So there can one only be one one main function in the global scope in a program. Functions in other scopes that are also called main are not affected by this, there can be any number of them. Alex Martelli Only one function can be named main outside of any namespace, just as for any other name. If you have namespaces foo and bar (etc) you can perfectly well have