You cannot have two main functions in one project. Put them in separate projects or rename one of the functions and call it from another main function.
You can never have more than one main () function in your project, since it is an entry point, regardless of what the list of parameters is.
However, you may have several declarations of other functions if the parameter list is different ( function overload ).
File 1
#include <iostream> using namespace std; int main() { cout<<"Hello World"; otherFunction(); return 0; }
File 2
#include <iostream> using namespace std; void otherFunction() { cout<<"Demo Program"; }
Don't forget about the appropriate #includes.
MrKiane
source share