ID: Q78202
7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg kbprb
The information in this article applies to:
- Microsoft C/C++ for MS-DOS, version 7.0
- Microsoft Visual C++ for Windows, versions 1.0 and 1.5
When starting a Windows or QuickWin application built with QuickC for Windows (QC/Win) version 1.0, C/C++ version 7.0, or Visual C++, the following message may appear:
UNRECOVERABLE APPLICATION ERROR
no main procedure
This message is generated if the application in question does not define a main() or WinMain() function. Because the C startup code uses weak externals to allow WinMain() to fix up main(), it is impossible to issue the message at compile time, as is done for an executable file designed for the MS-DOS operating system. A stub delivers the error message at run time.
To avoid this error, make sure that you define the proper entry point, as follows:
WinMain() for a Windows .EXE
main() or WinMain() for a QuickWin .EXE
The C startup code makes a weak external call to the main() function. If main() cannot be found, then a stub version of main() [the stub that gets control if there is no main() function in the program] makes a weak external call to WinMain(). If WinMain() cannot be found, a stub version of WinMain() issues the UAE.
Note that if a Windows .EXE has main() declared with the C calling convention or _main() declared with the Pascal calling convention, the program will compile successfully and the UAE will not occur. However, the program will terminate normally during execution of the startup code, without entering the application code.
Additional reference words: 7.00 1.00 1.50 KBCategory: kbprg kbprb KBSubcategory: CRTIss Keywords : kb16bitonly
Last Reviewed: July 18, 1997