hi my name is stackey maria i am a student of software engn. m learning from NIIT.
Please Can anybody tell me that how to Run a Program without (Main) in C++
i tried to find on Google but haven't get a good answer ! :(
if your "program" doesn't have a main function;
1. it's missing main, add it, compile it, run it.
2. it's not a program. so figure what it is, library, dll, what? act accordingly.
Contrary to popular belief C++ does not always require a main function, however the likelihood of you using a system the does not require it is small.
There are two kinds of implementation of the C++ standard; hosted and freestanding. A freestanding implementation is one that is designed for programs that are executed without the benefit of an operating system. For free standing implementation the requirement for a main function is implementation defined.
the standard wrote:
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. [Note: in a freestanding environment, start-up and termination is implementation-defined; startup contains the execution of constructors for objects of namespace scope with static storage duration; termination contains the execution of destructors for objects with static storage duration. ]
--- Edit:
in C# it runs without
Main()
Are you sure about that? The CLR has to make a call to an entry point and I'm fairly certain it has to be called Main. Even if it does not have to be called main it there has to be an entry point and you may just as well call it Main.