+ 1
without using main() program compile or not??
3 Answers
+ 2
A C++ program always starts at main(), without it the compiler will report an error.
Hope this helpful. đ
+ 1
The following applies to Windows:
You cannot build an executable (*.EXE/*.DLL) without some kind of main function, but you can build a static link library (*.LIB) without any main function.
The reason you need a type-of-main function is that the executable needs an entry point. Since you can only link to the functions exported from a static link lib, it does not need such a main function.
But note that under Windows you will need a DllMain function for a DLL (instead of a main function). The signature of DllMain is slightly different to a normal main function:
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
And for a windows EXE (i.e. one with a GUI) you traditionally use a WinMain function. the signature of this WinMain is slightly different as well:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
0
c++ and c programs are compile but not execute..