+ 1

without using main() program compile or not??

6th Feb 2017, 1:40 PM
Mayur Chaudhari
Mayur Chaudhari - avatar
3 Respuestas
+ 2
A C++ program always starts at main(), without it the compiler will report an error. Hope this helpful. 😀
6th Feb 2017, 2:00 PM
zhenxi
zhenxi - avatar
+ 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)
6th Feb 2017, 4:11 PM
Ettienne Gilbert
Ettienne Gilbert - avatar
0
c++ and c programs are compile but not execute..
6th Feb 2017, 2:08 PM
Mayur Chaudhari
Mayur Chaudhari - avatar